Package org.web3d.x3d.jsail.fields
Class SFString
java.lang.Object
org.web3d.x3d.jsail.fields.X3DConcreteField
org.web3d.x3d.jsail.fields.SFString
This utility class provides a concrete implementation corresponding to SFString X3D field type.
Warning: this is an abstract interface that cannot be instantiated as a concrete object. Java programmers typically only need to use concrete objects provided by the
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:
Warning: this is an abstract interface that cannot be instantiated as a concrete object. Java programmers typically only need to use concrete objects provided by the
org.web3d.x3d.jsail
classes.
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:
MFString
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Default value for this field type is an empty String.static final String
Default string value for this field type is "".static final String
String constant NAME provides name of this element: SFStringstatic final String
XML Regular Expression NameChar.static final String
XML Regular Expression NameFilter.static final String
XML Regular Expression NameStartChar.static final String
XML Regular Expression Nmtoken.static final Pattern
Precompiled regular expression (regex) pattern for this field type using default REGEX value.static final String
Default regular expression (regex) pattern for this field type is (\s|\S)*static final int
Default tuple size for this field type is 1 (i.e. number of component values making up a single-field SF object).Fields inherited from class org.web3d.x3d.jsail.fields.X3DConcreteField
validationResult
-
Constructor Summary
ConstructorDescriptionSFString()
Constructor for SFString performs value initialization.Constructor for SFString using a corresponding Java primitive String as new initial value.Constructor to copy an SFString value as initial value for this new field object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendValue
(String newValue) Append an additional String to this field.boolean
Determine whether two objects contain equal values.Provides current value of the field as a Java primitive type.getValue()
Get the current value.final void
Initialization for SFString applies default initial value.static final boolean
isArray()
Whether or not this field type is an array (false)boolean
Determine whether current value matches DEFAULT_VALUEstatic final boolean
Utility method to determine if string meets XML NMTOKEN requirementsstatic boolean
isX3dNodeName
(String value) Case-insensitive test whether or not string is a reserved X3D node name.static boolean
isX3dStatementName
(String value) Case-insensitive test whether or not string is a reserved X3D statement name.final boolean
matches()
Test PATTERN match via regular expression (regex) check of current object's toString() value.static final boolean
Test PATTERN match with regular expression (regex) of provided value.static final boolean
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
(String newValue) Append an additional String to this field.void
Assign a new value to this field.Apply an SFString value to this field.setValueByString
(String newValue) Utility accessor for SFString using String valuetoString()
Provides current value as a String.static String
Static utility method to provide String representation of a correctly typed input value.Provide String representation of this object, properly escaped for XML-based X3D syntax and conforming to X3D Canonical Form.static String
toStringX3D
(String value) Static utility method to provide String representation of input String, properly escaped using XML-based X3D syntax.final String
validate()
Validate current value via regular expression (regex) check of current object's toString() value, reporting errors only if found.final String
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
-
Field Details
-
NAME
String constant NAME provides name of this element: SFString- See Also:
-
DEFAULT_VALUE
Default value for this field type is an empty String.- See Also:
-
DEFAULT_VALUE_STRING
Default string value for this field type is "".- See Also:
-
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:
-
REGEX
Default regular expression (regex) pattern for this field type is (\s|\S)*- See Also:
-
PATTERN
Precompiled regular expression (regex) pattern for this field type using default REGEX value.- See Also:
-
NameStartCharFilter
XML 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:
-
NameCharFilter
XML Regular Expression NameChar. TODO integrate special-character support into regex. [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]- See Also:
-
NameFilter
XML Regular Expression NameFilter. TODO integrate special-character support into regex. [5] Name ::= NameStartChar (NameChar)*- See Also:
-
NmtokenFilter
XML Regular Expression Nmtoken. TODO integrate special-character support into regex. [7] Nmtoken ::= (NameChar)+- See Also:
-
-
Constructor Details
-
SFString
public SFString()Constructor for SFString performs value initialization. -
SFString
Constructor to copy an SFString value as initial value for this new field object.- Parameters:
newValue
- The newValue to apply
-
SFString
Constructor for SFString 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 SFString 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:
-
isNMTOKEN
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
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:
-
isX3dNodeName
Case-insensitive test whether or not string is a reserved X3D node name.- Parameters:
value
- to check- Returns:
- whether value is a reserved X3D node name
-
isX3dStatementName
Case-insensitive test whether or not string is a reserved X3D statement name.- Parameters:
value
- to check- Returns:
- whether value is a reserved X3D node name
-
appendValue
Append an additional String to this field.- Parameters:
newValue
- The value to append.- See Also:
-
prependValue
Append an additional String to this field.- Parameters:
newValue
- The value to append.- See Also:
-
equals
Determine whether two objects contain equal values.- Parameters:
comparisonSFString
- field type to compare- Returns:
- true if equivalent, false otherwise
-
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:
-
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:
-
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:
-
matches
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:
-
setValueByString
Utility accessor for SFString using String value- Parameters:
newValue
- is new value to assign- Returns:
MFMatrix4d
- namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same node object).- Throws:
InvalidFieldValueException
-
toString
-
toStringX3D
-
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:
-
getValue
-
getPrimitiveValue
Provides current value of the field as a Java primitive type.- Returns:
- current value
-
toString
-
setValue
-
setValue
-
isDefaultValue
public boolean isDefaultValue()Determine whether current value matches DEFAULT_VALUE- Returns:
- whether current value matches DEFAULT_VALUE
- See Also:
-