Class VRMLParserFactory
- Direct Known Subclasses:
BinaryX3DParserFactory
,DefaultVRMLParserFactory
This is the representation of a basic VRML parser. An parser implementation would extend this instance to provide a specific parser. The implementation class is specified by defining a system property
org.web3d.vrml.parser.file.factoryThe value of this property is the fully qualified class name of that implementation. When the
newVRMLParserFactory()
method is
called it will read that property and create a new instance using
reflection. The implementation must have a public, zero argument constructor
in order to be loaded.
Each time the newVRMLParserFactory()
method is called, it will
re-read the property and create an instance of the class. This allows you
to create different parser instances for each call within the one JVM
instance. If no property is defined then the default implementation is used.
All factories are required to support the feature name "VRML-utf8". The version is the VRML specification version supported in the UTF8 encoding (it is also possible the binary version may use this, but definitely not XML encoding).
The following a standard properties that may be required of all factories and readers
Name | Values | Default | Description |
---|---|---|---|
Required-Version | "2.0", "3.0" | NULL | When defined it says that the VRMLReader provided must only support the given version. If it is not supplied then the reader will do its best effort to adapt it's parsing to the version supplied in the stream's header |
Required-Format | "VRML", "X3D" | NULL | When defined it says to use this specific file format for the specification. |
- Version:
- $Revision: 1.10 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Property name for the factory instanceThe list of properties that have been set.static final String
Property defining the required file typestatic final String
Property defining a required versionstatic final String
Feature name for the required VRML featurestatic final String
Feature name for the required VRML feature -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Construct a default instance of this factory. -
Method Summary
Modifier and TypeMethodDescriptiongetProperty
(String prop) Get the value of the named property.abstract boolean
hasFeature
(String feature, String version) Check to see if this implementation has the nominated feature.static VRMLParserFactory
Create a new factory parser instance each time this method is called.abstract VRMLReader
Request a new instance of a VRMLReader to parse documents.void
setProperty
(String name, Object value) Set the value of the named property to the given value.
-
Field Details
-
FACTORY_CLASS_PROP
-
VRML_FEATURE
-
X3D_FEATURE
-
REQUIRE_VERSION_PROP
-
REQUIRE_FORMAT_PROP
-
propertyMap
-
-
Constructor Details
-
VRMLParserFactory
protected VRMLParserFactory()Construct a default instance of this factory.
-
-
Method Details
-
newVRMLParserFactory
Create a new factory parser instance each time this method is called. Looks up the system property and builds a new instance on demand.- Returns:
- An instance of the factory
- Throws:
FactoryConfigurationError
- The class could not be found for some reason or other startup error.
-
newVRMLReader
Request a new instance of a VRMLReader to parse documents.- Returns:
- A new reader instance
-
getProperty
Get the value of the named property. VRMLReaders are not required to support any specific property names.- Parameters:
prop
- The name of the property to get the value of- Returns:
- The value of the set property or null if not set
- Throws:
SAVNotSupportedException
- The VRMLReader does not recognize or does not support this property name.
-
setProperty
Set the value of the named property to the given value. VRMLReaders are not required to support any specific property names. Using a value of null will clear the currently set property value. Setting this value here will ensure that the value is set in each instance ofVRMLReader
before it is returned to the user after creation.- Parameters:
name
- The name of the property to setvalue
- The value of this property- Throws:
SAVNotSupportedException
- The VRMLReader does not recognize or does not support this property name.
-
hasFeature
Check to see if this implementation has the nominated feature. If there is no version information passed, it will look for features of all versions.- Parameters:
feature
- The name of the feature requestedversion
- The version of the feature required or null for none- Returns:
- true if the feature and version is supported
-