public abstract class AbstractInternalContext extends Object implements InternalContext
XMLContext. It is NOT meant to be directly instantiated by user implementations! For all
other objects it provides access to Castor state information (e.g. known descriptors) and
configuration values.| Constructor and Description |
|---|
AbstractInternalContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
addClass(Class<?> clazz)
Loads the class descriptor for the class instance specified.
|
void |
addClasses(Class<?>[] clazzes)
Loads the class descriptor for the class instance specified.
|
void |
addMapping(Mapping mapping)
Instructs Castor to load class descriptors from the mapping given.
|
void |
addPackage(String packageName)
Loads class descriptors from the package specified.
|
void |
addPackages(String[] packageNames)
Loads class descriptors from the packages specified.
|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener) |
Boolean |
getBooleanProperty(String propertyName)
Providing access to Boolean properties of the configuration.
|
ClassLoader |
getClassLoader()
To get the ClassLoader to use for loading resources.
|
Introspector |
getIntrospector()
To get the Introspector assigned to this XMLContext.
|
JavaNaming |
getJavaNaming()
The
JavaNaming instance to be used. |
boolean |
getLenientIdValidation()
Get lenient id validation flag.
|
boolean |
getLenientSequenceOrder()
Get lenient sequence order flag.
|
Boolean |
getLoadPackageMapping()
Get load package mapping flag.
|
MappingLoader |
getMappingLoader()
To get the
MappingLoader specified to be used in this Castor session. |
OutputFormat |
getOutputFormat()
Returns the default OutputFormat for use with a Serializer.
|
Parser |
getParser()
Return an XML document parser implementing the feature list specified in the configuration
file.
|
Parser |
getParser(String features)
Returns an XML document parser implementing the requested set of features.
|
NodeType |
getPrimitiveNodeType()
Returns the NodeType to use for Java primitives.
|
Object |
getProperty(String propertyName)
To get the value of a specific property.
|
RegExpEvaluator |
getRegExpEvaluator()
Returns a new instance of the specified Regular Expression Evaluator, or null if no validator
was specified.
|
ResolverStrategy |
getResolverStrategy()
To get the XMLClassDescriptor resolver strategy to be used when resolving classes into class
descriptors.
|
Serializer |
getSerializer()
Returns a default serializer for producing an XML document.
|
DocumentHandler |
getSerializer(OutputStream output)
Returns a default serializer for producing an XML document to the designated output stream
using the default serialization format.
|
DocumentHandler |
getSerializer(Writer output)
Returns a default serializer for producing an XML document to the designated output stream
using the default serialization format.
|
protected XMLSerializerFactory |
getSerializerFactory(String serializerFactoryName)
Returns the currently configured XMLSerializerFactory instance.
|
String |
getStringProperty(String propertyName)
Providing access to String properties of the configuration.
|
Boolean |
getUseIntrospector()
To get use-introspection flag.
|
XMLClassDescriptorResolver |
getXMLClassDescriptorResolver()
To get the XMLClassdescriptorResolver instance hold in the context.
|
XMLNaming |
getXMLNaming()
Returns the naming conventions to use for the XML framework.
|
XMLNaming |
getXMLNaming(ClassLoader classLoader)
Deprecated.
Makes no sence!
|
XMLReader |
getXMLReader()
Returns an XML document parser implementing the requested set of features.
|
XMLReader |
getXMLReader(String features)
Returns an XML document parser implementing the requested set of features.
|
boolean |
marshallingValidation()
To get marshalling-validation flag.
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener) |
void |
setClassLoader(ClassLoader classLoader)
To set the class loader to be used in all further marshalling, unmarshalling and other actions.
|
void |
setIntrospector(Introspector introspector)
To specify which
Introspector?is to be used. |
void |
setJavaNaming(JavaNaming javaNaming)
To set the
JavaNaming?property. |
void |
setJavaNaming(String javaNamingProperty) |
void |
setLoadPackageMapping(Boolean loadPackageMapping)
To set the load package mapping flag.
|
void |
setMappingLoader(MappingLoader mappingLoader)
To set the
MappingLoader to be used in this Castor session. |
void |
setProperty(String propertyName,
boolean value)
To set any boolean property.
|
void |
setProperty(String propertyName,
Object value)
To set properties for marshalling and unmarshalling behavior.
|
void |
setResolver(XMLClassDescriptorResolver xmlClassDescriptorResolver)
Sets an application-specific
XMLClassDescriptorResolver instance. |
void |
setResolverStrategy(ResolverStrategy resolverStrategy)
To set the XMLClassDescriptor resolver strategy to be used.
|
void |
setUseIntrospector(Boolean useIntrospector)
To set use-introspection flag.
|
void |
setXMLClassDescriptorResolver(XMLClassDescriptorResolver xmlClassDescriptorResolver)
To set the
XMLClassDescriptorResolver to be used. |
void |
setXMLNaming(String xmlNamingProperty)
This XMLNaming setter is meant to be used when working in property style instead of setting an
XMLNaming implementation.
|
void |
setXMLNaming(XMLNaming xmlNaming)
To set the
XMLNaming property. |
boolean |
strictElements()
To get strict-element flag.
|
public void addMapping(Mapping mapping) throws MappingException
InternalContextaddMapping in interface InternalContextmapping - Castor XML mapping (file), from which the required class descriptors will be
derived.MappingException - If the Mapping cannot be loaded and analyzed successfully.public void addClass(Class<?> clazz) throws ResolverException
InternalContextaddClass in interface InternalContextclazz - the class for which the associated descriptor should be loaded.ResolverException - in case that resolving the Class fails fatallypublic void addClasses(Class<?>[] clazzes) throws ResolverException
InternalContextaddClasses in interface InternalContextclazzes - the classes for which the associated descriptor should be loaded.ResolverException - in case that resolving the Class fails fatallypublic void addPackage(String packageName) throws ResolverException
InternalContextPlease note that this functionality will work only if you provide the .castor.cdr file with your generated classes (as generated by the XML code generator).
addPackage in interface InternalContextpackageName - The package name for the (descriptor) classesResolverException - If there's a problem loading class descriptors for the given package.public void addPackages(String[] packageNames) throws ResolverException
InternalContextPlease note that this functionality will work only if you provide the .castor.cdr files with your generated classes (as generated by the XML code generator).
addPackages in interface InternalContextpackageNames - The package names for the (descriptor) classesResolverException - If there's a problem loading class descriptors for the given package.public void setResolver(XMLClassDescriptorResolver xmlClassDescriptorResolver)
InternalContextXMLClassDescriptorResolver instance.setResolver in interface InternalContextxmlClassDescriptorResolver - the resolver to usepublic void setProperty(String propertyName, Object value)
InternalContextsetProperty in interface InternalContextpropertyName - name of the property to setvalue - the value to set topublic Object getProperty(String propertyName)
InternalContextgetProperty in interface InternalContextpropertyName - name of the Propertypublic XMLNaming getXMLNaming()
InternalContextgetXMLNaming in interface InternalContextpublic XMLNaming getXMLNaming(ClassLoader classLoader)
InternalContextgetXMLNaming in interface InternalContextclassLoader - the class loader to be used when instantiating a new naming instancepublic JavaNaming getJavaNaming()
InternalContextJavaNaming instance to be used.getJavaNaming in interface InternalContextJavaNaming instance to be used.public Parser getParser()
InternalContextgetParser in interface InternalContextpublic Parser getParser(String features)
InternalContextgetParser in interface InternalContextfeatures - The requested feature list, null for the defaultspublic XMLReader getXMLReader()
InternalContextgetXMLReader in interface InternalContextpublic XMLReader getXMLReader(String features)
InternalContextgetXMLReader in interface InternalContextfeatures - the name of feature to setpublic NodeType getPrimitiveNodeType()
InternalContextgetPrimitiveNodeType in interface InternalContextpublic RegExpEvaluator getRegExpEvaluator()
InternalContextgetRegExpEvaluator in interface InternalContextpublic Serializer getSerializer()
InternalContextgetSerializer in interface InternalContextpublic OutputFormat getOutputFormat()
InternalContextgetOutputFormat in interface InternalContextprotected XMLSerializerFactory getSerializerFactory(String serializerFactoryName)
serializerFactoryName - the class name of the serializer factorypublic DocumentHandler getSerializer(OutputStream output) throws IOException
InternalContextgetSerializer in interface InternalContextoutput - The output streamIOException - if instantiation of the serializer failspublic DocumentHandler getSerializer(Writer output) throws IOException
InternalContextgetSerializer in interface InternalContextoutput - The output streamIOException - if instantiation of serializer failspublic XMLClassDescriptorResolver getXMLClassDescriptorResolver()
InternalContextgetXMLClassDescriptorResolver in interface InternalContextpublic Introspector getIntrospector()
InternalContextgetIntrospector in interface InternalContextpublic ResolverStrategy getResolverStrategy()
InternalContextgetResolverStrategy in interface InternalContextpublic void setResolverStrategy(ResolverStrategy resolverStrategy)
InternalContextsetResolverStrategy in interface InternalContextresolverStrategy - the ResolverStrategy to usepublic void setMappingLoader(MappingLoader mappingLoader)
InternalContextMappingLoader to be used in this Castor session.setMappingLoader in interface InternalContextmappingLoader - the MappingLoader to usepublic MappingLoader getMappingLoader()
InternalContextMappingLoader specified to be used in this Castor session.getMappingLoader in interface InternalContextMappingLoader to usepublic void setJavaNaming(JavaNaming javaNaming)
InternalContextJavaNaming?property.setJavaNaming in interface InternalContextjavaNaming - the JavaNaming to usepublic void setJavaNaming(String javaNamingProperty)
public void setXMLNaming(XMLNaming xmlNaming)
InternalContextXMLNaming property.setXMLNaming in interface InternalContextxmlNaming - the XMLNaming to usepublic void setXMLNaming(String xmlNamingProperty)
xmlNamingProperty - to set the XMLNaming property as read from configurationpublic void setProperty(String propertyName, boolean value)
InternalContextsetProperty in interface InternalContextpropertyName - name of the property to setvalue - boolean value to setpublic Boolean getBooleanProperty(String propertyName)
InternalContextgetBooleanProperty in interface InternalContextpropertyName - name of the propertypublic String getStringProperty(String propertyName)
InternalContextgetStringProperty in interface InternalContextpropertyName - name of the propertypublic void setClassLoader(ClassLoader classLoader)
InternalContextsetClassLoader in interface InternalContextclassLoader - the ClassLoader instance to usepublic void setXMLClassDescriptorResolver(XMLClassDescriptorResolver xmlClassDescriptorResolver)
InternalContextXMLClassDescriptorResolver to be used. Be aware, that the
XMLClassDescriptorResolver instance holds a descriptor cache!! Maybe change it to have the
descriptor cache as part of the context?setXMLClassDescriptorResolver in interface InternalContextxmlClassDescriptorResolver - the XMLClassDescriptorResolver to usepublic void setIntrospector(Introspector introspector)
InternalContextIntrospector?is to be used.setIntrospector in interface InternalContextintrospector - Introspector to be usedpublic ClassLoader getClassLoader()
InternalContextgetClassLoader in interface InternalContextpublic boolean getLenientIdValidation()
InternalContextgetLenientIdValidation in interface InternalContextpublic boolean getLenientSequenceOrder()
InternalContextgetLenientSequenceOrder in interface InternalContextpublic Boolean getLoadPackageMapping()
InternalContextgetLoadPackageMapping in interface InternalContextpublic void setLoadPackageMapping(Boolean loadPackageMapping)
InternalContextsetLoadPackageMapping in interface InternalContextloadPackageMapping - the load package mapping flagpublic Boolean getUseIntrospector()
InternalContextgetUseIntrospector in interface InternalContextpublic void setUseIntrospector(Boolean useIntrospector)
InternalContextsetUseIntrospector in interface InternalContextuseIntrospector - use-introspection flagpublic boolean marshallingValidation()
InternalContextmarshallingValidation in interface InternalContextpublic boolean strictElements()
InternalContextstrictElements in interface InternalContextpublic void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener in interface PropertyChangeProviderpublic void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
addPropertyChangeListener in interface PropertyChangeProviderpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener in interface PropertyChangeProviderpublic void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
removePropertyChangeListener in interface PropertyChangeProviderCopyright © 2016. All rights reserved.