Package ome.xml.model
Class AbstractOMEModelObject
java.lang.Object
ome.xml.model.AbstractOMEModelObject
- All Implemented Interfaces:
OMEModelObject
- Direct Known Subclasses:
AffineTransform
,Annotation
,BinaryFile
,BinaryOnly
,BinData
,Channel
,Dataset
,Experiment
,Experimenter
,ExperimenterGroup
,External
,Folder
,Image
,ImagingEnvironment
,Instrument
,LightPath
,ManufacturerSpec
,MetadataOnly
,MicrobeamManipulation
,OME
,Pixels
,Plane
,Plate
,PlateAcquisition
,Project
,Reagent
,Reference
,Rights
,ROI
,Screen
,Shape
,StageLabel
,StructuredAnnotations
,TiffData
,TransmittanceRange
,Union
,UUID
,Well
,WellSample
public abstract class AbstractOMEModelObject extends java.lang.Object implements OMEModelObject
- Author:
- callan
-
Constructor Summary
Constructors Constructor Description AbstractOMEModelObject()
-
Method Summary
Modifier and Type Method Description abstract org.w3c.dom.Element
asXMLElement(org.w3c.dom.Document document)
Takes the entire object hierarchy and produces an XML DOM tree.protected org.w3c.dom.Element
asXMLElement(org.w3c.dom.Document document, org.w3c.dom.Element element)
Takes the entire object hierarchy and produced an XML DOM tree taking into account class hierarchy.static java.util.List<org.w3c.dom.Element>
getChildrenByTagName(org.w3c.dom.Element parent, java.lang.String name)
Retrieves all the children of an element that have a given tag name.boolean
link(Reference reference, OMEModelObject o)
Link a given OME model object to this model object.static java.lang.String
stripNamespacePrefix(java.lang.String v)
Strips the namespace prefix off of a given tag name.void
update(org.w3c.dom.Element element, OMEModel model)
Updates the object hierarchy recursively from an XML DOM tree.
-
Constructor Details
-
AbstractOMEModelObject
public AbstractOMEModelObject()
-
-
Method Details
-
update
Description copied from interface:OMEModelObject
Updates the object hierarchy recursively from an XML DOM tree. NOTE: No properties are removed, only added or updated.- Specified by:
update
in interfaceOMEModelObject
- Parameters:
element
- Root of the XML DOM tree to construct a model object graph from.model
- Handler for the OME model which keeps track of instances and references seen during object population.- Throws:
EnumerationException
- If there is an error instantiating an enumeration during model object creation.
-
asXMLElement
public abstract org.w3c.dom.Element asXMLElement(org.w3c.dom.Document document)Description copied from interface:OMEModelObject
Takes the entire object hierarchy and produces an XML DOM tree.- Specified by:
asXMLElement
in interfaceOMEModelObject
- Parameters:
document
- Destination document for element creation, etc.- Returns:
- XML DOM tree root element for this model object.
-
asXMLElement
protected org.w3c.dom.Element asXMLElement(org.w3c.dom.Document document, org.w3c.dom.Element element)Takes the entire object hierarchy and produced an XML DOM tree taking into account class hierarchy.- Parameters:
document
- Destination document for element creation, etc.element
- Element from the subclass. Ifnull
a new element will be created of this class.- Returns:
element
populated with properties from this class.
-
link
Description copied from interface:OMEModelObject
Link a given OME model object to this model object.- Specified by:
link
in interfaceOMEModelObject
- Parameters:
reference
- The type qualifier for the reference. This should be the corresponding reference type foro
. If, for example,o
is of typeImage
,reference
MUST be of typeImageRef
.o
- Model object to link to.- Returns:
true
if this model object was able to handle the reference,false
otherwise.
-
getChildrenByTagName
public static java.util.List<org.w3c.dom.Element> getChildrenByTagName(org.w3c.dom.Element parent, java.lang.String name)Retrieves all the children of an element that have a given tag name. If a tag has a namespace prefix it will be stripped prior to attempting a name match.- Parameters:
parent
- DOM element to retrieve tags based upon.name
- Name of the tags to retrieve.- Returns:
- List of elements which have the tag
name
.
-
stripNamespacePrefix
public static java.lang.String stripNamespacePrefix(java.lang.String v)Strips the namespace prefix off of a given tag name.- Parameters:
v
- Tag name to strip the prefix from if it has one.- Returns:
v
with the namespace prefix stripped orv
if it has none.
-