Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.instance.model.impl
Class DefaultInstance

java.lang.Object
  extended by eu.esdihumboldt.hale.common.instance.model.impl.DefaultGroup
      extended by eu.esdihumboldt.hale.common.instance.model.impl.DefaultInstance
All Implemented Interfaces:
Group, Instance, MutableGroup, MutableInstance
Direct Known Subclasses:
StreamGmlInstance

public class DefaultInstance
extends DefaultGroup
implements MutableInstance

Default instance implementation backed by a ListMultimap.

Author:
Simon Templer

Constructor Summary
DefaultInstance(Instance org)
          Copy constructor.
DefaultInstance(TypeDefinition definition, DataSet dataSet)
          Create an empty instance.
 
Method Summary
 DataSet getDataSet()
          Get the data set the instance is associated to.
 TypeDefinition getDefinition()
          Get the group definition
 List<Object> getMetaData(String key)
          Get the metadata the instance my be associated with
 Set<String> getMetaDataNames()
          Get all keys the metadata is associated with
 Object getValue()
          Get the instance value.

The value is only present for certain types where the HasValueFlag or AugmentedValueFlag constraint is enabled.
 void putMetaData(String key, Object obj)
          add Data to the MetaData, which the Instance can be associated with If there is no MetaData in the Instance, a new container will be created
 void setDataSet(DataSet dataSet)
          Set the data set the instance is associated to.
 void setMetaData(String key, Object... values)
          Sets the metadata of a certain key, may also delet or reset the value of the key if the values parameter is null or empty
 void setValue(Object value)
          Set the instance value.
 
Methods inherited from class eu.esdihumboldt.hale.common.instance.model.impl.DefaultGroup
addProperty, getProperty, getPropertyNames, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.esdihumboldt.hale.common.instance.model.MutableGroup
addProperty, setProperty
 
Methods inherited from interface eu.esdihumboldt.hale.common.instance.model.Group
getProperty, getPropertyNames
 

Constructor Detail

DefaultInstance

public DefaultInstance(TypeDefinition definition,
                       DataSet dataSet)
Create an empty instance.

Parameters:
definition - the associated type definition
dataSet - the data set the instance is associated to

DefaultInstance

public DefaultInstance(Instance org)
Copy constructor. Creates an instance based on the properties and values of the given instance.

Parameters:
org - the instance to copy
Method Detail

getValue

public Object getValue()
Description copied from interface: Instance
Get the instance value.

The value is only present for certain types where the HasValueFlag or AugmentedValueFlag constraint is enabled. The Binding constraint on the type definition defines the binding of the value.

NOTE: This is needed for instance for XML elements with text content and attributes. It may only be a simple value (i.e. no Group or Instance).

Specified by:
getValue in interface Instance
Returns:
the instance value if it is defined, otherwise null
See Also:
Instance.getValue()

getDataSet

public DataSet getDataSet()
Description copied from interface: Instance
Get the data set the instance is associated to.

Specified by:
getDataSet in interface Instance
Returns:
the instance data set, null if not set
See Also:
Instance.getDataSet()

setValue

public void setValue(Object value)
Description copied from interface: MutableInstance
Set the instance value. It may only be a simple value, no collection or Instance.

Specified by:
setValue in interface MutableInstance
Parameters:
value - the instance value to set
See Also:
MutableInstance.setValue(Object)

setDataSet

public void setDataSet(DataSet dataSet)
Description copied from interface: MutableInstance
Set the data set the instance is associated to.

Specified by:
setDataSet in interface MutableInstance
Parameters:
dataSet - the instance data set
See Also:
MutableInstance.setDataSet(DataSet)

getDefinition

public TypeDefinition getDefinition()
Description copied from interface: Group
Get the group definition

Specified by:
getDefinition in interface Group
Specified by:
getDefinition in interface Instance
Overrides:
getDefinition in class DefaultGroup
Returns:
the group definition
See Also:
DefaultGroup.getDefinition()

getMetaData

public List<Object> getMetaData(String key)
Description copied from interface: Instance
Get the metadata the instance my be associated with

Specified by:
getMetaData in interface Instance
Parameters:
key - the key to access a certain metadata
Returns:
A list of objects from the metadata, may be an empty List if the key can not be found or there is not metadata associated with the Instance
See Also:
Instance.getMetaData(java.lang.String)

putMetaData

public void putMetaData(String key,
                        Object obj)
Description copied from interface: MutableInstance
add Data to the MetaData, which the Instance can be associated with If there is no MetaData in the Instance, a new container will be created

Specified by:
putMetaData in interface MutableInstance
Parameters:
key - a key the data to add will be associated with
obj - the Data to add, may not be Instance or Group
See Also:
MutableInstance.putMetaData(java.lang.String, java.lang.Object)

getMetaDataNames

public Set<String> getMetaDataNames()
Description copied from interface: Instance
Get all keys the metadata is associated with

Specified by:
getMetaDataNames in interface Instance
Returns:
an Set of String keys, or an empty Set if the data doesn't exist or the container is empty, the Set may not be changed
See Also:
Instance.getMetaDataNames()

setMetaData

public void setMetaData(String key,
                        Object... values)
Description copied from interface: MutableInstance
Sets the metadata of a certain key, may also delet or reset the value of the key if the values parameter is null or empty

Specified by:
setMetaData in interface MutableInstance
Parameters:
key - the key the data is associated with
values - the values to set, may not contain Instance or Group
See Also:
MutableInstance.setMetaData(java.lang.String, java.lang.Object[])

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d