Package org.web3d.x3d.jsail.fields
Class SFStringObject
java.lang.Object
org.web3d.x3d.jsail.fields.X3DConcreteField
org.web3d.x3d.jsail.fields.SFStringObject
public class SFStringObject extends X3DConcreteField implements SFString
This utility class provides a concrete implementation corresponding to SFString X3D field type.
Package hint: This specification class is defined by the X3D Java Language Binding Specification for the Scene Authoring Interface (SAI). SFString defines a single string encoded with the UTF-8 universal character set.
Related field object:
Package hint: This specification class is defined by the X3D Java Language Binding Specification for the Scene Authoring Interface (SAI). SFString defines a single string encoded with the UTF-8 universal character set.
Related field object:
MFStringObject
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_VALUE
Default value for this field type is an empty String.static java.lang.String
DEFAULT_VALUE_STRING
Default string value for this field type is "".static java.lang.String
NAME
String constant NAME provides name of this element: SFStringstatic java.lang.String
NameCharFilter
XML Regular Expression NameChar.static java.lang.String
NameFilter
XML Regular Expression NameFilter.static java.lang.String
NameStartCharFilter
XML Regular Expression NameStartChar.static java.lang.String
NmtokenFilter
XML Regular Expression Nmtoken.static java.util.regex.Pattern
PATTERN
Precompiled regular expression (regex) pattern for this field type using default REGEX value.static java.lang.String
REGEX
Default regular expression (regex) pattern for this field type is (\s|\S)*static int
TUPLE_SIZE
Default tuple size for this field type is 1 (i.e. number of component values making up a single-field SF object). -
Constructor Summary
Constructors Constructor Description SFStringObject()
Constructor for SFStringObject performs value initialization.SFStringObject(java.lang.String newValue)
Constructor for SFStringObject using a corresponding Java primitive String as new initial value.SFStringObject(SFStringObject newValue)
Constructor to copy an SFStringObject value as initial value for this new field object. -
Method Summary
Modifier and Type Method Description void
appendValue(java.lang.String newValue)
Append an additional String to this field.boolean
equals(SFStringObject comparisonSFStringObject)
Determine whether two objects contain equal values.java.lang.String
getPrimitiveValue()
Provides current value of the field as a Java primitive type.java.lang.String
getValue()
Get the current value.void
initialize()
Initialization for SFStringObject applies default initial value.static boolean
isArray()
Whether or not this field type is an array (false)boolean
isDefaultValue()
Determine whether current value matches DEFAULT_VALUEstatic boolean
isNMTOKEN(java.lang.String value)
Utility method to determine if string meets XML NMTOKEN requirementsboolean
matches()
Test PATTERN match via regular expression (regex) check of current object's toString() value.static boolean
matches(java.lang.String value)
Test PATTERN match with regular expression (regex) of provided value.static boolean
meetsX3dInteroperabilityNamingConventions(java.lang.String value)
Utility method to determine if string meets suggested X3D naming conventions: starts with letter or underscore character, includes letter character numeral or underscore characters.void
prependValue(java.lang.String newValue)
Append an additional String to this field.void
setValue(java.lang.String newValue)
Assign a new value to this field.SFStringObject
setValue(SFStringObject newValue)
Apply an SFStringObject value to this field.SFStringObject
setValueByString(java.lang.String newValue)
Utility accessor for SFStringObject using String valuejava.lang.String
toString()
Provides current value as a String.static java.lang.String
toString(java.lang.String value)
Static utility method to provide String representation of a correctly typed input value.java.lang.String
toStringX3D()
Provide String representation of this object, properly escaped for XML-based X3D syntax and conforming to X3D Canonical Form.static java.lang.String
toStringX3D(java.lang.String value)
Static utility method to provide String representation of input String, properly escaped using XML-based X3D syntax.java.lang.String
validate()
Validate current value via regular expression (regex) check of current object's toString() value, reporting errors only if found.java.lang.String
validateRegex()
Validate current value via regular expression (regex) check of current object's toString() value, reporting errors only if found.Methods inherited from class org.web3d.x3d.jsail.fields.X3DConcreteField
addX3DEventListener, getDefinition, getTupleSize, getValidationResult, isReadable, isWritable, removeX3DEventListener, setReadable, setWritable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.web3d.x3d.sai.X3DField
addX3DEventListener, getDefinition, isReadable, isWritable, removeX3DEventListener
-
Field Details
-
NAME
public static final java.lang.String NAMEString constant NAME provides name of this element: SFString- See Also:
- Constant Field Values
-
DEFAULT_VALUE
public static final java.lang.String DEFAULT_VALUEDefault value for this field type is an empty String. -
DEFAULT_VALUE_STRING
public static final java.lang.String DEFAULT_VALUE_STRINGDefault string value for this field type is "".- See Also:
- Constant Field Values
-
TUPLE_SIZE
public static final int TUPLE_SIZEDefault tuple size for this field type is 1 (i.e. number of component values making up a single-field SF object).- See Also:
- Constant Field Values
-
REGEX
public static final java.lang.String REGEXDefault regular expression (regex) pattern for this field type is (\s|\S)* -
PATTERN
public static final java.util.regex.Pattern PATTERNPrecompiled regular expression (regex) pattern for this field type using default REGEX value.- See Also:
REGEX
,matches()
,matches(String)
,validate()
, java.util.regex.Pattern
-
NameStartCharFilter
public static final java.lang.String NameStartCharFilterXML Regular Expression NameStartChar. TODO integrate special-character support into regex. [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]- See Also:
- XML 1.1 NameStartChar, Constant Field Values
-
NameCharFilter
public static final java.lang.String NameCharFilterXML Regular Expression NameChar. TODO integrate special-character support into regex. [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]- See Also:
- XML 1.1 NameChar, Constant Field Values
-
NameFilter
public static final java.lang.String NameFilterXML Regular Expression NameFilter. TODO integrate special-character support into regex. [5] Name ::= NameStartChar (NameChar)*- See Also:
- XML 1.1 NameFilter, Constant Field Values
-
NmtokenFilter
public static final java.lang.String NmtokenFilterXML Regular Expression Nmtoken. TODO integrate special-character support into regex. [7] Nmtoken ::= (NameChar)+- See Also:
- XML 1.1 Nmtoken, Constant Field Values
-
-
Constructor Details
-
SFStringObject
public SFStringObject()Constructor for SFStringObject performs value initialization. -
SFStringObject
Constructor to copy an SFStringObject value as initial value for this new field object.- Parameters:
newValue
- The newValue to apply
-
SFStringObject
public SFStringObject(java.lang.String newValue)Constructor for SFStringObject using a corresponding Java primitive String as new initial value.- Parameters:
newValue
- is new value to assign setContainerFieldOverride(containerFieldName); // apply checksConcreteField#getTupleSize(String)
-
-
Method Details
-
isArray
public static final boolean isArray()Whether or not this field type is an array (false)- Returns:
- true if array type
-
initialize
public final void initialize()Initialization for SFStringObject applies default initial value. Static initializer also provided to verify that the regex pattern compiles and matches that default value.- Specified by:
initialize
in classX3DConcreteField
- See Also:
- Stack Overflow: How to check if a given Regex is valid?,
DEFAULT_VALUE
-
isNMTOKEN
public static final boolean isNMTOKEN(java.lang.String value)Utility method to determine if string meets XML NMTOKEN requirements- Parameters:
value
- string to check- Returns:
- whether value meets NMTOKEN regex checks
- See Also:
meetsX3dInteroperabilityNamingConventions(String)
, X3D Scene Authoring Hints: Naming Conventions, X3D Tooltips: type NMTOKEN, X3D Regular Expressions (regexes), XML 1.0 Recommendation, 2.3 Common Syntactic Constructs, XML 1.1 NMTOKEN, Java Language Specification: 3 Lexical Structure, 3.2. Lexical Translations, Java Tutorials: Unicode, Java and Unicode: Supplementary Characters in the Java Platform
-
meetsX3dInteroperabilityNamingConventions
public static final boolean meetsX3dInteroperabilityNamingConventions(java.lang.String value)Utility method to determine if string meets suggested X3D naming conventions: starts with letter or underscore character, includes letter character numeral or underscore characters. Avoids whitespace, apostrophe, hyphen, minus, comma, period or other special characters in order to ensure portability- Parameters:
value
- string to check- Returns:
- whether value meets suggested X3D naming requirements
- See Also:
isNMTOKEN(String)
, X3D Scene Authoring Hints: Naming Conventions, X3D Tooltips: type NMTOKEN, X3D Regular Expressions (regexes), XML 1.0 Recommendation, 2.3 Common Syntactic Constructs, XML 1.1 NMTOKEN, Java Language Specification: 3 Lexical Structure, 3.2. Lexical Translations, Java Tutorials: Unicode, Java and Unicode: Supplementary Characters in the Java Platform
-
appendValue
public void appendValue(java.lang.String newValue)Append an additional String to this field.- Parameters:
newValue
- The value to append.- See Also:
String.concat(String)
-
prependValue
public void prependValue(java.lang.String newValue)Append an additional String to this field.- Parameters:
newValue
- The value to append.- See Also:
appendValue(String)
-
equals
Determine whether two objects contain equal values.- Parameters:
comparisonSFStringObject
- field type to compare- Returns:
- true if equivalent, false otherwise
-
validate
public final java.lang.String validate()Validate current value via regular expression (regex) check of current object's toString() value, reporting errors only if found.- Returns:
- empty string if PATTERN matches, warning otherwise
- See Also:
- java.util.regex.Pattern,
validate()
,validateRegex()
-
validateRegex
public final java.lang.String validateRegex()Validate current value via regular expression (regex) check of current object's toString() value, reporting errors only if found.- Returns:
- empty string if PATTERN matches, warning otherwise
- See Also:
REGEX
,PATTERN
,matches()
,matches(String)
,validate()
,validate()
, java.util.regex.Pattern
-
matches
public final boolean matches()Test PATTERN match via regular expression (regex) check of current object's toString() value.- Returns:
- true if PATTERN matches, false otherwise
- See Also:
REGEX
,PATTERN
,matches()
,matches(String)
,validate()
, java.util.regex.Pattern
-
matches
public static final boolean matches(java.lang.String value)Test PATTERN match with regular expression (regex) of provided value.- Parameters:
value
- String to check against regex pattern for successful match- Returns:
- true if PATTERN matches, false otherwise
- See Also:
REGEX
,PATTERN
,matches()
,matches(String)
,validate()
, java.util.regex.Pattern
-
setValueByString
public SFStringObject setValueByString(java.lang.String newValue) throws InvalidFieldValueExceptionUtility accessor for SFStringObject using String value- Parameters:
newValue
- is new value to assign- Returns:
MFMatrix4dObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same node object).- Throws:
InvalidFieldValueException
-
toString
public static java.lang.String toString(java.lang.String value)Static utility method to provide String representation of a correctly typed input value.- Parameters:
value
- The value to convert to a String- Returns:
- XML/X3D-escaped String version of the provided value
- See Also:
- X3D Tooltips: type,
toStringX3D(java.lang.String)
,MFStringObject.toStringX3D()
, X3D Abstract Specification: 5.3.14 SFString and MFString, X3D XML Encoding: 5.15 SFString and MFString, X3D Tooltips: Text, X3D Tooltips: type
-
toStringX3D
public static java.lang.String toStringX3D(java.lang.String value)Static utility method to provide String representation of input String, properly escaped using XML-based X3D syntax.- Parameters:
value
- The value to convert to an escaped String- Returns:
- XML/X3D-escaped String version of the provided value
- See Also:
toStringX3D(java.lang.String)
,MFStringObject.toStringX3D()
, X3D Abstract Specification: 5.3.14 SFString and MFString, X3D XML Encoding: 5.15 SFString and MFString, X3D Tooltips: Text, X3D Tooltips: type
-
toStringX3D
public java.lang.String toStringX3D()Provide String representation of this object, properly escaped for XML-based X3D syntax and conforming to X3D Canonical Form.- Returns:
- XML/X3D-escaped version of this SFString
- See Also:
toStringX3D(String)
,MFStringObject.toStringX3D()
,X3DObject.FILE_EXTENSION_X3D
,X3DObject.FILE_EXTENSION_XML
, X3D Tooltips: type SFString, X3D XML Encoding, X3D Compressed Binary Encoding: X3D Canonical Form, X3D Canonicalization (C14N) Tool
-
getValue
public java.lang.String getValue()Get the current value. -
getPrimitiveValue
public java.lang.String getPrimitiveValue()Provides current value of the field as a Java primitive type.- Returns:
- current value
-
toString
public java.lang.String toString()Provides current value as a String.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String version of the provided value
- See Also:
- X3D Tooltips: type SFString
-
setValue
public void setValue(java.lang.String newValue)Assign a new value to this field.- Specified by:
setValue
in interfaceSFString
- Parameters:
newValue
- The replacement value to assign.- See Also:
X3DConcreteField.getTupleSize(String)
-
setValue
Apply an SFStringObject value to this field.- Parameters:
newValue
- The newValue to apply- Returns:
SFStringObject
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).
-
isDefaultValue
public boolean isDefaultValue()Determine whether current value matches DEFAULT_VALUE- Returns:
- whether current value matches DEFAULT_VALUE
- See Also:
DEFAULT_VALUE
-