org.apache.uima.resource.metadata
Interface MetaDataObject

All Superinterfaces:
Cloneable, Serializable, XMLizable
All Known Subinterfaces:
AllowedValue, AnalysisEngineDescription, AnalysisEngineMetaData, Capability, CapabilityLanguageFlow, CasConsumerDescription, CasInitializerDescription, CasProcessorDeploymentParam, CasProcessorErrorHandling, CasProcessorErrorRateThreshold, CasProcessorExecArg, CasProcessorExecutable, CasProcessorFilter, CasProcessorMaxRestarts, CasProcessorRunInSeperateProcess, CasProcessorRuntimeEnvParam, CasProcessorTimeout, CollectionReaderDescription, ConfigurableDataResourceSpecifier, ConfigurationGroup, ConfigurationParameter, ConfigurationParameterDeclarations, ConfigurationParameterSettings, CpeCasProcessor, CpeCasProcessors, CpeCheckpoint, CpeCollectionReader, CpeCollectionReaderCasInitializer, CpeCollectionReaderIterator, CpeComponentDescriptor, CpeConfiguration, CpeDescription, CpeInclude, CpeIntegratedCasProcessor, CpeLocalCasProcessor, CpeRemoteCasProcessor, CpeResourceManagerConfiguration, CpeSofaMapping, CpeSofaMappings, CustomResourceSpecifier, ExternalResourceBinding, ExternalResourceDependency, ExternalResourceDescription, FeatureDescription, FileLanguageResourceSpecifier, FileResourceSpecifier, FixedFlow, FlowConstraints, FlowControllerDeclaration, FlowControllerDescription, FsIndexCollection, FsIndexDescription, FsIndexKeyDescription, Import, JMSMessagingSpecifier, LanguagePrecondition, MailMessagingSpecifier, MessagingSpecifier, MimeTypePrecondition, MQMessagingSpecifier, NameValuePair, OutputQueue, Parameter, PearSpecifier, Precondition, ProcessingResourceMetaData, ResourceCreationSpecifier, ResourceManagerConfiguration, ResourceMetaData, ResourceServiceSpecifier, ResourceSpecifier, ResourceSpecifierList, SimplePrecondition, SofaMapping, TaeDescription, TypeDescription, TypeOrFeature, TypePriorities, TypePriorityList, TypeSystemDescription, URISpecifier

public interface MetaDataObject
extends Cloneable, Serializable, XMLizable

An object used to represent metadata of a Resource.

A list of all attributes on a MetaDataObject can be obtained by calling its listAttributes() method. The values of attributes can be get and set by using the getAttributeValue(String) and setAttributeValue(String,Object) methods. The value of an attribute may be any Object, including another MetaDataObject.

MetaDataObjects are not required to allow modification of their attributes' values. An application should check the isModifiable() method to determine if attribute values can be modified. Calling setAttributeValue(String,Object) on an unmodifiable object will result in a UIMA_UnsupportedOperationException.


Method Summary
 Object clone()
          Creates a clone of this MetaDataObject.
 boolean equals(Object aObj)
          Determines if this object is equal to another.
 Object getAttributeValue(String aName)
          Retrieves the value of an attribute of this MetaDataObject.
 URL getSourceUrl()
          Gets the URL from which this object was parsed.
 String getSourceUrlString()
          If the sourceURL of this object is non-null, returns its string representation.
 boolean isModifiable()
          Returns whether this MetaDataObject allows the values of its attributes to be modified.
 List<NameClassPair> listAttributes()
          Retrieves all attributes on this MetaDataObject.
 void setAttributeValue(String aName, Object aValue)
          Sets the value of an attribute of this MetaDataObject.
 void setSourceUrl(URL aUrl)
          Sets the URL from which this object was parsed.
 
Methods inherited from interface org.apache.uima.util.XMLizable
buildFromXMLElement, buildFromXMLElement, toXML, toXML, toXML, toXML
 

Method Detail

listAttributes

List<NameClassPair> listAttributes()
Retrieves all attributes on this MetaDataObject.

Returns:
a List containing NameClassPair objects, 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.Integer instead of int).

getAttributeValue

Object getAttributeValue(String aName)
Retrieves the value of an attribute of this MetaDataObject.

Parameters:
aName - the name of the parameter to get
Returns:
the value of the parameter named aName. Returns null if there is no attribute with that name.

isModifiable

boolean isModifiable()
Returns whether this MetaDataObject allows the values of its attributes to be modified.

Returns:
true if and only if this object's attributes may be modified.

setAttributeValue

void setAttributeValue(String aName,
                       Object aValue)
Sets the value of an attribute of this MetaDataObject. Applications should first check the isModifiable() method; calling setAttributeValue(String, Object) on an unmodifiable MetaDataObject will result in an exception.

Parameters:
aName - the name of the parameter to set
aValue - the value to assign to the parameter
Throws:
UIMA_UnsupportedOperationException - if this MetaDataObject is not modifiable.
UIMA_IllegalArgumentException - if the given value is not appropriate for the given attribute.

clone

Object clone()
Creates a clone of this MetaDataObject. This performs a "deep" copy by cloning all attribute values that are also MetaDataObjects.

Returns:
a clone of this MetaDataObject

equals

boolean equals(Object aObj)
Determines if this object is equal to another. Two MetaDataObjects are equal if they share the same attributes and the same values for those attributes.

Overrides:
equals in class Object
Parameters:
aObj - an object with which to compare this object
Returns:
true if and only if this object equals aObj

getSourceUrl

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.

Returns:
the source URL from which this object was parsed

getSourceUrlString

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.

Returns:
the source URL as a string, or "<unknown>"

setSourceUrl

void setSourceUrl(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.

Parameters:
aUrl - the location of the XML file from which this object was parsed


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.