Class MetaDataObject_impl
- java.lang.Object
-
- org.apache.uima.resource.metadata.impl.MetaDataObject_impl
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,MetaDataObject,XMLizable
- Direct Known Subclasses:
AllowedValue_impl,Attribute_impl,Capability_impl,CapabilityLanguageFlow_impl,CasProcessorCpeObject,CasProcessorDeploymentParamImpl,CasProcessorDeploymentParamsImpl,CasProcessorErrorHandlingImpl,CasProcessorErrorRateThresholdImpl,CasProcessorExecArgImpl,CasProcessorExecutableImpl,CasProcessorFilterImpl,CasProcessorMaxRestartsImpl,CasProcessorRunInSeperateProcessImpl,CasProcessorRuntimeEnvParamImpl,CasProcessorTimeoutImpl,ConfigurableDataResourceSpecifier_impl,ConfigurationGroup_impl,ConfigurationParameter_impl,ConfigurationParameterDeclarations_impl,ConfigurationParameterSettings_impl,CpeCasProcessorsImpl,CpeCheckpointImpl,CpeCollectionReaderCasInitializerImpl,CpeCollectionReaderImpl,CpeCollectionReaderIteratorImpl,CpeComponentDescriptorImpl,CpeConfigurationImpl,CpeDescriptionImpl,CpeIncludeImpl,CpeResourceManagerConfigurationImpl,CpeSofaMappingImpl,CpeSofaMappingsImpl,CustomResourceSpecifier_impl,ExternalResourceBinding_impl,ExternalResourceDependency_impl,ExternalResourceDescription_impl,FeatureDescription_impl,FileLanguageResourceSpecifier_impl,FileResourceSpecifier_impl,Filter_impl,FixedFlow_impl,FlowControllerDeclaration_impl,FsIndexCollection_impl,FsIndexDescription_impl,FsIndexKeyDescription_impl,Import_impl,IndexBuildItem_impl,IndexBuildSpecification_impl,IndexRule_impl,Mapping_impl,NameValuePair_impl,OperationalProperties_impl,OutputQueue_impl,Parameter_impl,PearSpecifier_impl,ResourceCreationSpecifier_impl,ResourceManagerConfiguration_impl,ResourceMetaData_impl,ResultSpecification_impl,SimplePrecondition_impl,SofaMapping_impl,Style_impl,TypeDescription_impl,TypeOrFeature_impl,TypePriorities_impl,TypePriorityList_impl,TypeSystemDescription_impl,URISpecifier_impl
public abstract class MetaDataObject_impl extends java.lang.Object implements MetaDataObject
Abstract base class for all MetaDataObjects in the reference implementation. Provides basic support for getting and setting property values given their names, using bean introspection and reflection.Also provides the ability to write objects to XML and build objects from their DOM representation, as required to implement the
XMLizableinterface, which is a superinterface ofMetaDataObject. In future versions, this could be replaced by a non-proprietary XML binding solution such as JAXB or EMF.The implementation for getting and setting property values uses the JavaBeans introspection API. Therefore subclasses of this class must be valid JavaBeans and either use the standard naming conventions for getters and setters. BeanInfo augmentation is ignored; the implementation here uses the flag IGNORE_ALL_BEANINFO. See The Java Beans Tutorial for more information. To support XML Comments, which can occur between any sub-elements, including array values, the "data" for all objects is stored in a pair of ArrayLists; one holds the "name" of the slot, the other the value; comments are interspersed within this list where they occur. To the extent possible, this should be the *only* data storage used for the xml element. Subclasses should access these elements on demand. Data will be read into / written from this representation; Cloning will copy this information. For getters that need to do some special initial processing, a global flag will be set whenever this base code changes the underlying value.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMetaDataObject_impl.MetaDataAttrstatic classMetaDataObject_impl.SerialContextInformation, kept globally (by thread) for one serialization Inherited by some custom impls, e.g.static interfaceMetaDataObject_impl.Serializermethods used for serializing
-
Field Summary
Fields Modifier and Type Field Description private static ConcurrentHashMapWithProducer<java.lang.Class<? extends MetaDataObject_impl>,MetaDataObject_impl.MetaDataAttr[]>class2attrsMapprivate static ConcurrentHashMapWithProducer<java.lang.Class<? extends MetaDataObject_impl>,MetaDataObject_impl.MetaDataAttr[]>class2attrsMapUnfilteredprivate static java.util.List<MetaDataObject_impl.MetaDataAttr>EMPTY_ATTRIBUTE_LISTprivate static org.xml.sax.AttributesEMPTY_ATTRIBUTESprivate org.w3c.dom.Nodeinfosetprivate java.net.URLmSourceUrlprivate static java.lang.StringPROP_NAME_INFOSETprivate static java.lang.StringPROP_NAME_SOURCE_URLstatic java.lang.ThreadLocal<MetaDataObject_impl.SerialContext>serialContextKeeps the serialContext by thread set when starting to serialize cleared at the end (in finally clause) to prevent memory leaks Inherited by some custom impls, e.g.(package private) static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description MetaDataObject_impl()Creates a newMetaDataObject_implwith null attribute values
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbuildFromXMLElement(org.w3c.dom.Element aElement, XMLParser aParser)Initializes this object from its XML DOM representation.voidbuildFromXMLElement(org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions)Initializes this object from its XML DOM representation.java.lang.Objectclone()Creates a clone of thisMetaDataObject.booleanequals(java.lang.Object aObj)Determines if this object is equal to another.java.util.List<MetaDataObject_impl.MetaDataAttr>getAdditionalAttributes()Override this method to include additional attributesjava.lang.ClassgetAttributeClass(java.lang.String aName)Gets the Class of the given attribute's value.(package private) MetaDataObject_impl.MetaDataAttr[]getAttributes()On first call, looks up the information using JavaBeans introspection, but then caches the result for subsequent calls.private voidgetAttributesFromBeans(java.lang.Class<? extends MetaDataObject_impl> clazz)java.lang.ObjectgetAttributeValue(java.lang.String aName)Retrieves the value of an attribute of thisMetaDataObject.private java.lang.ObjectgetAttributeValue(MetaDataObject_impl.MetaDataAttr attr)org.w3c.dom.NodegetInfoset()protected org.w3c.dom.NodegetMatchingNode(MetaDataObject_impl.SerialContext serialContext, java.lang.String name)protected java.beans.PropertyDescriptor[]getPropertyDescriptors()Deprecated.- use getAttributes insteadprotected PropertyXmlInfogetPropertyXmlInfo(java.lang.String aXmlElementName)Looks in this class's XmlizationInfo for a property with the given XML element name.java.net.URLgetRelativePathBase()Gets the relative path base used to resolve imports.static MetaDataObject_impl.SerialContextgetSerialContext(org.xml.sax.ContentHandler ch)private static MetaDataObject_impl.SerializergetSerializerFromContentHandler(org.xml.sax.ContentHandler aContentHandler)java.net.URLgetSourceUrl()Gets the URL from which this object was parsed.java.lang.StringgetSourceUrlString()If the sourceURL of this object is non-null, returns its string representation.(package private) MetaDataObject_impl.MetaDataAttr[]getUnfilteredAttributes()Like getAttributes, but doesn't filter the attributes.protected static java.lang.ClassgetWrapperClass(java.lang.Class aPrimitiveType)Gets the wrapper class corresponding to the given primitive type.protected org.xml.sax.helpers.AttributesImplgetXMLAttributes()Called by thetoXML(ContentHandler, boolean)method to get the XML attributes that will be written as part of the element's tag.protected abstract XmlizationInfogetXmlizationInfo()To be implemented by subclasses to return information describing how to represent this object in XML.inthashCode()Gets the hash code for this object.booleanisModifiable()Returns whether this object is modifiable.java.util.List<NameClassPair>listAttributes()Deprecated.- use getAttributesprotected voidreadArrayPropertyValueFromXMLElement(PropertyXmlInfo aPropXmlInfo, java.lang.Class aPropClass, org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions)Utility method to read an array property's value from its DOM representation.protected voidreadMapPropertyFromXml(java.lang.String aPropName, org.w3c.dom.Element aElement, java.lang.String aKeyXmlAttribute, java.lang.String aValueTagName, XMLParser aParser, XMLParser.ParsingOptions aOptions, boolean aValueIsArray)Utility method for reading from XML an attribute whose value is aMapwithStringkeys andXMLizable(or an array of these) values.protected voidreadPropertyValueFromXMLElement(PropertyXmlInfo aPropXmlInfo, org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions)Utility method to read an attribute's value from its DOM representation.protected voidreadUnknownPropertyValueFromXMLElement(org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions, java.util.List<java.lang.String> aKnownPropertyNames)Utility method that attempts to read a property value from an XML element even though it is not known to which property the value should be assigned.protected java.lang.StringresolveSettings(java.lang.String text)voidsetAttributeValue(java.lang.String aName, java.lang.Object aValue)Sets the value of an attribute of thisMetaDataObject.private voidsetAttributeValue(MetaDataObject_impl.MetaDataAttr attr, java.lang.Object aValue)voidsetInfoset(org.w3c.dom.Node infoset)voidsetSourceUrl(java.net.URL aUrl)Sets the URL from which this object was parsed.voidsetSourceUrlIfNull(java.net.URL aUrl)Sets the source URL of this object, only if that URL is currently set to null.java.lang.StringtoString()Dump this metadata object's attributes and values to a String.voidtoXML(java.io.OutputStream aOutputStream)Writes out this object's XML representation.voidtoXML(java.io.Writer aWriter)Writes out this object's XML representation.private voidtoXML(XMLSerializer sax2xml)voidtoXML(org.xml.sax.ContentHandler aContentHandler)This is called internally, also for JSon serializationvoidtoXML(org.xml.sax.ContentHandler aContentHandler, boolean aWriteDefaultNamespaceAttribute)Writes this object's XML representation by making calls on a SAXContentHandler.private voidtoXMLcommon(boolean aWriteDefaultNamespaceAttribute)booleanvalueIsNullOrEmptyArray(java.lang.Object val)private booleanvaluesEqual(java.lang.Object val1, java.lang.Object val2)Compare 2 values for equality.protected voidwriteArrayPropertyAsElement(java.lang.String aPropName, java.lang.Class aPropClass, java.lang.Object aValue, java.lang.String aArrayElementTagName, java.lang.String aNamespace)Utility method used to write an array property out as an XML element.protected voidwriteMapPropertyToXml(java.lang.String aPropName, java.lang.String aXmlElementName, java.lang.String aKeyXmlAttribute, java.lang.String aValueTagName, boolean aOmitIfNull, java.lang.String aNamespace)Utility method for writing to XML an property whose value is aMapwithStringkeys andXMLizablevalues.private voidwritePrimitiveValue(java.lang.Object aObj)Writes a standard XML representation of the specified Object, in the form:
<className>string value%lt;/className%gt;protected voidwritePropertyAsElement(PropertyXmlInfo aPropInfo, java.lang.String aNamespace)Utility method used to write a property out as an XML element.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
-
PROP_NAME_SOURCE_URL
private static java.lang.String PROP_NAME_SOURCE_URL
-
PROP_NAME_INFOSET
private static java.lang.String PROP_NAME_INFOSET
-
EMPTY_ATTRIBUTES
private static final org.xml.sax.Attributes EMPTY_ATTRIBUTES
-
EMPTY_ATTRIBUTE_LIST
private static final java.util.List<MetaDataObject_impl.MetaDataAttr> EMPTY_ATTRIBUTE_LIST
-
class2attrsMap
private static final transient ConcurrentHashMapWithProducer<java.lang.Class<? extends MetaDataObject_impl>,MetaDataObject_impl.MetaDataAttr[]> class2attrsMap
-
class2attrsMapUnfiltered
private static final transient ConcurrentHashMapWithProducer<java.lang.Class<? extends MetaDataObject_impl>,MetaDataObject_impl.MetaDataAttr[]> class2attrsMapUnfiltered
-
serialContext
public static final java.lang.ThreadLocal<MetaDataObject_impl.SerialContext> serialContext
Keeps the serialContext by thread set when starting to serialize cleared at the end (in finally clause) to prevent memory leaks Inherited by some custom impls, e.g. TypeOrFeature_impl
-
mSourceUrl
private transient java.net.URL mSourceUrl
-
infoset
private transient org.w3c.dom.Node infoset
-
-
Method Detail
-
getSerialContext
public static MetaDataObject_impl.SerialContext getSerialContext(org.xml.sax.ContentHandler ch)
-
setInfoset
public void setInfoset(org.w3c.dom.Node infoset)
-
getInfoset
public org.w3c.dom.Node getInfoset()
-
getAdditionalAttributes
public java.util.List<MetaDataObject_impl.MetaDataAttr> getAdditionalAttributes()
Override this method to include additional attributes- Returns:
- additional attributes
-
getUnfilteredAttributes
MetaDataObject_impl.MetaDataAttr[] getUnfilteredAttributes()
Like getAttributes, but doesn't filter the attributes. Design is only for backwards compatibility. Unfiltered version used only by getAttributeValue and setAttributeValue- Returns:
- an unfiltered array of Attribute objects associated with this class
-
getAttributes
MetaDataObject_impl.MetaDataAttr[] getAttributes()
On first call, looks up the information using JavaBeans introspection, but then caches the result for subsequent calls. Any class which wants to add additional parameters needs to implement / override getAdditionalParameters.- Returns:
- an array of Attribute objects associated with this class
-
getAttributesFromBeans
private void getAttributesFromBeans(java.lang.Class<? extends MetaDataObject_impl> clazz)
-
listAttributes
@Deprecated public java.util.List<NameClassPair> listAttributes()
Deprecated.- use getAttributesReturns a list ofNameClassPairobjects indicating the attributes of this object and the String names of the Classes of the attributes' values. For primitive types, the wrapper classes will be returned (e.g.java.lang.Integerinstead of int). Several subclasses override this, to add additional items to the list.- Specified by:
listAttributesin interfaceMetaDataObject- Returns:
- a List containing
NameClassPairobjects, each of which contains the name of a parameter and the Class of its value. For primitive types, the wrapper classes will be returned (e.g.java.lang.Integerinstead of int). - See Also:
MetaDataObject.listAttributes()
-
getAttributeValue
private java.lang.Object getAttributeValue(MetaDataObject_impl.MetaDataAttr attr)
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String aName)
Description copied from interface:MetaDataObjectRetrieves the value of an attribute of thisMetaDataObject.- Specified by:
getAttributeValuein interfaceMetaDataObject- Parameters:
aName- the name of the parameter to get- Returns:
- the value of the parameter named
aName. Returnsnullif there is no attribute with that name. - See Also:
MetaDataObject.getAttributeValue(String)
-
getAttributeClass
public java.lang.Class getAttributeClass(java.lang.String aName)
Gets the Class of the given attribute's value. For primitive types, the wrapper classes will be returned (e.g.java.lang.Integerinstead of int).- Parameters:
aName- name of an attribute- Returns:
- Class of value that may be assigned to the named attribute. Returns
nullif there is no attribute with the given name.
-
isModifiable
public boolean isModifiable()
Returns whether this object is modifiable. MetaDataObjects are modifiable by default.- Specified by:
isModifiablein interfaceMetaDataObject- Returns:
- true if and only if this object's attributes may be modified.
- See Also:
MetaDataObject.isModifiable()
-
setAttributeValue
private void setAttributeValue(MetaDataObject_impl.MetaDataAttr attr, java.lang.Object aValue)
-
setAttributeValue
public void setAttributeValue(java.lang.String aName, java.lang.Object aValue)Description copied from interface:MetaDataObjectSets the value of an attribute of thisMetaDataObject. Applications should first check theMetaDataObject.isModifiable()method; callingMetaDataObject.setAttributeValue(String, Object)on an unmodifiableMetaDataObjectwill result in an exception.- Specified by:
setAttributeValuein interfaceMetaDataObject- Parameters:
aName- the name of the parameter to setaValue- the value to assign to the parameter- See Also:
MetaDataObject.setAttributeValue(String, Object)
-
getRelativePathBase
public java.net.URL getRelativePathBase()
Gets the relative path base used to resolve imports. This is equal to the sourceUrl of this object, if known (i.e. if the object was parsed from an XML file or if setSourceUrl was explicitly called). If the source URL is not known, the value of the user.dir System property is returned.- Returns:
- the base URL for resolving relative paths in this object
-
getSourceUrl
public java.net.URL getSourceUrl()
Gets the URL from which this object was parsed. When this object is parsed from an XML file, this is set by the parser to the URL of the source file XML file. If the object has been created by some other method, the source URL will not be known, and this method will return null.This setting is used to resolve imports and is also included in exception messages to indicate the source of the problem.
- Specified by:
getSourceUrlin interfaceMetaDataObject- Returns:
- the source URL from which this object was parsed
-
getSourceUrlString
public java.lang.String getSourceUrlString()
If the sourceURL of this object is non-null, returns its string representation. If it is null, returns "<unknown>". Useful for error messages.- Specified by:
getSourceUrlStringin interfaceMetaDataObject- Returns:
- the source URL as a string, or "<unknown>"
-
setSourceUrlIfNull
public void setSourceUrlIfNull(java.net.URL aUrl)
Sets the source URL of this object, only if that URL is currently set to null. This is used internally to update null relative base paths before doing import resolution, without overriding user-specified settings.- Parameters:
aUrl- the location of the XML file from which this object was parsed
-
setSourceUrl
public void setSourceUrl(java.net.URL aUrl)
Sets the URL from which this object was parsed. Typically only the XML parser sets this. This recursively sets the source URL of all descendants of this object. Recursion doesn't happen for sub arrays/maps of maps or arrays.- Specified by:
setSourceUrlin interfaceMetaDataObject- Parameters:
aUrl- the location of the XML file from which this object was parsed
-
clone
public java.lang.Object clone()
Description copied from interface:MetaDataObjectCreates a clone of thisMetaDataObject. This performs a "deep" copy by cloning all attribute values that are also MetaDataObjects.- Specified by:
clonein interfaceMetaDataObject- Overrides:
clonein classjava.lang.Object- Returns:
- a clone of this
MetaDataObject - See Also:
multi-core: could be cloning while another thread is modifying?
-
toString
public java.lang.String toString()
Dump this metadata object's attributes and values to a String. This is useful for debugging.- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object aObj)
Determines if this object is equal to another. Two MetaDataObjects are equivalent if they share the same attributes and the same values for those attributes.- Specified by:
equalsin interfaceMetaDataObject- Overrides:
equalsin classjava.lang.Object- Parameters:
aObj- object with which to compare this object- Returns:
- true if and only if this object is equal to
aObj
-
valuesEqual
private boolean valuesEqual(java.lang.Object val1, java.lang.Object val2)Compare 2 values for equality. Reason val1.equals(val2) is not used: If val1 is of type Object[], the equal test is object identity equality, not element by element identity. So we use Arrays.equals or deepEquals instead.- Parameters:
val1-val2-- Returns:
- true if equal
-
hashCode
public int hashCode()
Gets the hash code for this object. The hash codes of two NameClassPairsxandymust be equal ifx.equals(y)returns true;- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code for this object
-
toXML
public void toXML(java.io.Writer aWriter) throws org.xml.sax.SAXException, java.io.IOExceptionWrites out this object's XML representation.
-
toXML
public void toXML(java.io.OutputStream aOutputStream) throws org.xml.sax.SAXException, java.io.IOExceptionWrites out this object's XML representation.
-
toXML
private void toXML(XMLSerializer sax2xml) throws org.xml.sax.SAXException, java.io.IOException
- Throws:
org.xml.sax.SAXExceptionjava.io.IOException
-
toXML
public void toXML(org.xml.sax.ContentHandler aContentHandler) throws org.xml.sax.SAXExceptionThis is called internally, also for JSon serialization- Specified by:
toXMLin interfaceXMLizable- Parameters:
aContentHandler- the content handler to which this object will write events that describe its XML representation.- Throws:
org.xml.sax.SAXException- pass thru- See Also:
XMLizable.toXML(ContentHandler)
-
toXML
public void toXML(org.xml.sax.ContentHandler aContentHandler, boolean aWriteDefaultNamespaceAttribute) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLizableWrites this object's XML representation by making calls on a SAXContentHandler.- Specified by:
toXMLin interfaceXMLizable- Parameters:
aContentHandler- the content handler to which this object will write events that describe its XML representation.aWriteDefaultNamespaceAttribute- whether the namespace of this element should be written as the default namespace. This should be done only for the root element, and it defaults to false.- Throws:
org.xml.sax.SAXException- pass thru- See Also:
This is called internally, also for JSon serialization If this is the first call to serialize, create a serialContext (and clean up afterwards) Other callers (e.g. JSON) must set the serialContext first before calling
-
getSerializerFromContentHandler
private static MetaDataObject_impl.Serializer getSerializerFromContentHandler(org.xml.sax.ContentHandler aContentHandler)
-
toXMLcommon
private void toXMLcommon(boolean aWriteDefaultNamespaceAttribute) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
getXMLAttributes
protected org.xml.sax.helpers.AttributesImpl getXMLAttributes()
Called by thetoXML(ContentHandler, boolean)method to get the XML attributes that will be written as part of the element's tag. By default this method returns an empty Attributes object. Subclasses may override it in order to write attributes to the XML.- Returns:
- an object defining the attributes to be written to the XML
-
getXmlizationInfo
protected abstract XmlizationInfo getXmlizationInfo()
To be implemented by subclasses to return information describing how to represent this object in XML.- Returns:
- information defining this object's XML representation
-
getPropertyXmlInfo
protected PropertyXmlInfo getPropertyXmlInfo(java.lang.String aXmlElementName)
Looks in this class's XmlizationInfo for a property with the given XML element name.- Parameters:
aXmlElementName- the unqualified name of an XML element- Returns:
- information on the property that corresponds to the given element name,
nullif none.
-
valueIsNullOrEmptyArray
public boolean valueIsNullOrEmptyArray(java.lang.Object val)
-
writePropertyAsElement
protected void writePropertyAsElement(PropertyXmlInfo aPropInfo, java.lang.String aNamespace) throws org.xml.sax.SAXException
Utility method used to write a property out as an XML element.- Parameters:
aPropInfo- information on how to represent the property in XMLaNamespace- XML namespace URI for this object representation- Throws:
org.xml.sax.SAXException- -
-
writeArrayPropertyAsElement
protected void writeArrayPropertyAsElement(java.lang.String aPropName, java.lang.Class aPropClass, java.lang.Object aValue, java.lang.String aArrayElementTagName, java.lang.String aNamespace) throws org.xml.sax.SAXExceptionUtility method used to write an array property out as an XML element.- Parameters:
aPropName- name of the attributeaPropClass- class of the attributeaValue- value (guaranteed to be an array and non-null)aArrayElementTagName- name of tag to be assigned to each element of the array. May benull, in which case each element will be assigned a value appropriate to its class.aNamespace- the XML namespace URI for this object- Throws:
org.xml.sax.SAXException- -
-
writeMapPropertyToXml
protected void writeMapPropertyToXml(java.lang.String aPropName, java.lang.String aXmlElementName, java.lang.String aKeyXmlAttribute, java.lang.String aValueTagName, boolean aOmitIfNull, java.lang.String aNamespace) throws org.xml.sax.SAXExceptionUtility method for writing to XML an property whose value is aMapwithStringkeys andXMLizablevalues.- Parameters:
aPropName- name of the property to write to XMLaXmlElementName- name of the XML element for the property,nullif noneaKeyXmlAttribute- name of the XML attribute for the keyaValueTagName- XML element tag name to use for each entry in the MapaOmitIfNull- if true, null or empty map will not be written at all, if false, null or empty map will be written as an empty elementaNamespace- namespace for this object- Throws:
org.xml.sax.SAXException- passthru
-
buildFromXMLElement
public final void buildFromXMLElement(org.w3c.dom.Element aElement, XMLParser aParser) throws InvalidXMLExceptionInitializes this object from its XML DOM representation. This method is typically called from theXMLParser.- Specified by:
buildFromXMLElementin interfaceXMLizable- Parameters:
aElement- the XML element that represents this object.aParser- a reference to the UIMAXMLParser. TheXMLParser.buildObject(Element)method can be used to construct sub-objects.- Throws:
InvalidXMLException- if the input XML element does not specify a valid object
-
buildFromXMLElement
public void buildFromXMLElement(org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions) throws InvalidXMLExceptionInitializes this object from its XML DOM representation. This method is typically called from theXMLParser. It is overridden by specific Java impl classes to provide additional defaulting (e.g. see AnalysisEngineDescription_impl)- Specified by:
buildFromXMLElementin interfaceXMLizable- Parameters:
aElement- the XML element that represents this object.aParser- a reference to the UIMAXMLParser. TheXMLParser.buildObject(Element)method can be used to construct sub-objects.aOptions- option settings- Throws:
InvalidXMLException- if the input XML element does not specify a valid object
-
readPropertyValueFromXMLElement
protected void readPropertyValueFromXMLElement(PropertyXmlInfo aPropXmlInfo, org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions) throws InvalidXMLException
Utility method to read an attribute's value from its DOM representation.- Parameters:
aPropXmlInfo- information about the property to readaElement- DOM element to read fromaParser- parser to use to construct complex valuesaOptions- option settings- Throws:
InvalidXMLException- -
-
readArrayPropertyValueFromXMLElement
protected void readArrayPropertyValueFromXMLElement(PropertyXmlInfo aPropXmlInfo, java.lang.Class aPropClass, org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions) throws InvalidXMLException
Utility method to read an array property's value from its DOM representation.- Parameters:
aPropXmlInfo- information about the property to readaPropClass- class of the property's valueaElement- DOM element representing the entire arrayaParser- parser to use to construct complex valuesaOptions- option settings- Throws:
InvalidXMLException- -
-
readUnknownPropertyValueFromXMLElement
protected void readUnknownPropertyValueFromXMLElement(org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions, java.util.List<java.lang.String> aKnownPropertyNames) throws InvalidXMLExceptionUtility method that attempts to read a property value from an XML element even though it is not known to which property the value should be assigned. If an object can be constructed from the XML element, it will be assigned to any unasigned property that can accept it.- Parameters:
aElement- DOM element to read fromaParser- parser to use to construct complex valuesaOptions- -aKnownPropertyNames- List of propertiees that we've already values for (these values will not be overwritten)- Throws:
InvalidXMLException- if no acceptable object is described by aElement
-
readMapPropertyFromXml
protected void readMapPropertyFromXml(java.lang.String aPropName, org.w3c.dom.Element aElement, java.lang.String aKeyXmlAttribute, java.lang.String aValueTagName, XMLParser aParser, XMLParser.ParsingOptions aOptions, boolean aValueIsArray) throws InvalidXMLExceptionUtility method for reading from XML an attribute whose value is aMapwithStringkeys andXMLizable(or an array of these) values.- Parameters:
aPropName- name of the property to read from XMLaElement- element to read fromaKeyXmlAttribute- XML attribute for the keyaValueTagName- XML element tag name for each entry in the mapaParser- parser to use to build sub-objectsaOptions- parsing option settingsaValueIsArray- true if the value of the map entires is an array. This method only supports homogeneous arrays.- Throws:
InvalidXMLException- -
-
getWrapperClass
protected static java.lang.Class getWrapperClass(java.lang.Class aPrimitiveType)
Gets the wrapper class corresponding to the given primitive type. For example,java.lang.Integeris the wrapper class for the primitive typeint.- Parameters:
aPrimitiveType-Classobject representing a primitive type- Returns:
Classobject representing the wrapper type forPrimitiveType. IfaPrimitiveTypeis not a primitive type, it is itself returned.
-
getPropertyDescriptors
@Deprecated protected java.beans.PropertyDescriptor[] getPropertyDescriptors() throws java.beans.IntrospectionExceptionDeprecated.- use getAttributes insteadUtility method that introspects this bean and returns a list ofPropertyDescriptors for its properties.The JavaBeans introspector is used, with the IGNORE_ALL_BEANINFO flag. This saves on initialization time by preventing the introspector from searching for nonexistent BeanInfo classes for all the MetaDataObjects. Caching needed, this method is called for every access to a field, and introspection doesn't cache (from observation... although the javadocs say otherwise (as of Java6 10/2011 - both IBM and Sun)
- Returns:
- the
PropertyDescriptorsfor all properties introduced by subclasses ofMetaDataObject_impl. - Throws:
java.beans.IntrospectionException- if introspection fails
-
writePrimitiveValue
private void writePrimitiveValue(java.lang.Object aObj) throws org.xml.sax.SAXExceptionWrites a standard XML representation of the specified Object, in the form:
<className>string value%lt;/className%gt;where
classNameis the object's java class name without the package and made lowercase, e.g. "string","integer", "boolean" andstring valueis the result ofObject.toString().This is intended to be used for Java Strings and wrappers for primitive value classes (e.g. Integer, Boolean). For JSON, the value is output as { java-class name : value } unless the value is just a string, in which case we output just the string
- Parameters:
aObj- the object to writeaContentHandler- the SAX ContentHandler to which events will be sent- Throws:
org.xml.sax.SAXException- if the ContentHandler throws an exception
-
getMatchingNode
protected org.w3c.dom.Node getMatchingNode(MetaDataObject_impl.SerialContext serialContext, java.lang.String name)
-
resolveSettings
protected java.lang.String resolveSettings(java.lang.String text)
-
-