|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bc.ceres.core.ExtensibleObject
org.esa.beam.framework.datamodel.ProductNode
org.esa.beam.framework.datamodel.MetadataElement
public class MetadataElement
A MetadataElement is a data node used to store metadata. Metadata elements can have any number of
metadata attributes of the type MetadataAttribute and any number of inner MetadataElements.
| Field Summary |
|---|
| Fields inherited from class org.esa.beam.framework.datamodel.ProductNode |
|---|
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME |
| Constructor Summary | |
|---|---|
MetadataElement(String name)
Constructs a new metadata element. |
|
| Method Summary | |
|---|---|
void |
acceptVisitor(ProductVisitor visitor)
Accepts the given visitor. |
void |
addAttribute(MetadataAttribute attribute)
Adds an attribute to this node. |
void |
addAttributeFast(MetadataAttribute attribute)
Deprecated. since BEAM 4.7, addAttribute(MetadataAttribute) should now be fast enough |
void |
addElement(MetadataElement element)
Adds the given element to this element. |
void |
addElementAt(MetadataElement element,
int index)
Adds the given element to this element at index. |
boolean |
containsAttribute(String name)
Checks whether this node has an element with the given name. |
boolean |
containsElement(String name)
Tests if a element with the given name is contained in this element. |
MetadataElement |
createDeepClone()
|
void |
dispose()
Releases all of the resources used by this object instance and all of its owned children. |
MetadataAttribute |
getAttribute(String name)
Returns the attribute with the given name. |
MetadataAttribute |
getAttributeAt(int index)
Returns the attribute at the given index. |
double |
getAttributeDouble(String name)
Returns the double value of the attribute with the given name. |
double |
getAttributeDouble(String name,
double defaultValue)
Returns the double value of the attribute with the given name. |
int |
getAttributeIndex(MetadataAttribute attribute)
Gets the index of the given attribute. |
int |
getAttributeInt(String name)
Returns the integer value of the attribute with the given name. |
int |
getAttributeInt(String name,
int defaultValue)
Returns the integer value of the attribute with the given name. |
String[] |
getAttributeNames()
Returns the names of all attributes of this node. |
MetadataAttribute[] |
getAttributes()
Returns an array of attributes contained in this element. |
String |
getAttributeString(String name)
Returns the string value of the attribute with the given name. |
String |
getAttributeString(String name,
String defaultValue)
Returns the string value of the attribute with the given name. |
ProductData.UTC |
getAttributeUTC(String name)
Returns the UTC value of the attribute with the given name. |
ProductData.UTC |
getAttributeUTC(String name,
ProductData.UTC defaultValue)
Returns the UTC value of the attribute with the given name. |
MetadataElement |
getElement(String name)
Returns the element with the given name. |
MetadataElement |
getElementAt(int index)
Returns the element at the given index. |
ProductNodeGroup<MetadataElement> |
getElementGroup()
Gets the group of child elements. |
int |
getElementIndex(MetadataElement element)
Gets the index of the given element. |
String[] |
getElementNames()
Returns a string array containing the names of the groups contained in this element |
MetadataElement[] |
getElements()
Returns an array of elements contained in this element. |
int |
getNumAttributes()
Returns the number of attributes attaached to this node. |
int |
getNumElements()
|
MetadataElement |
getParentElement()
|
long |
getRawStorageSize(ProductSubsetDef subsetDef)
Gets an estimated, raw storage size in bytes of this product node. |
boolean |
removeAttribute(MetadataAttribute attribute)
Removes the given attribute from this annotation. |
boolean |
removeElement(MetadataElement element)
Removes the given element from this element. |
void |
setAttributeDouble(String name,
double value)
Sets the attribute with the given name to the given double value. |
void |
setAttributeInt(String name,
int value)
Sets the attribute with the given name to the given integer value. |
void |
setAttributeString(String name,
String value)
Sets the attribute with the given name to the given string value. |
void |
setAttributeUTC(String name,
ProductData.UTC value)
Sets the attribute with the given name to the given utc value. |
void |
setModified(boolean modified)
Sets this node's modified flag. |
| Methods inherited from class org.esa.beam.framework.datamodel.ProductNode |
|---|
fireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReader, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriter, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, removeFromFile, setDescription, setName, setOwner, toString, updateExpression |
| Methods inherited from class com.bc.ceres.core.ExtensibleObject |
|---|
getExtension |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MetadataElement(String name)
name - the element name| Method Detail |
|---|
public ProductNodeGroup<MetadataElement> getElementGroup()
public MetadataElement getParentElement()
public void addElement(MetadataElement element)
element - the element to added, ignored if null
public void addElementAt(MetadataElement element,
int index)
element - the element to added, ignored if nullindex - where to put itpublic boolean removeElement(MetadataElement element)
element - the element to be removed, ignored if null
public int getNumElements()
public MetadataElement getElementAt(int index)
index - the element index
IndexOutOfBoundsException - if the index is out of boundspublic String[] getElementNames()
public MetadataElement[] getElements()
public MetadataElement getElement(String name)
name - the element name
null if a element with the given name is not contained in
this element.public boolean containsElement(String name)
name - the name, must not be null
true if a element with the given name is contained in this element, false
otherwisepublic int getElementIndex(MetadataElement element)
element - The element .
public void addAttribute(MetadataAttribute attribute)
attribute - the attribute to be added, null is ignoredpublic boolean removeAttribute(MetadataAttribute attribute)
attribute - the attribute to be removed, null is ignored
true if it was removedpublic int getNumAttributes()
public MetadataAttribute getAttributeAt(int index)
index - the attribute index
null if this node does not contain attributes
IndexOutOfBoundsExceptionpublic String[] getAttributeNames()
nullpublic MetadataAttribute[] getAttributes()
public MetadataAttribute getAttribute(String name)
name - the attribute name
null if it could not be foundpublic boolean containsAttribute(String name)
name - the attribute name
true if sopublic int getAttributeIndex(MetadataAttribute attribute)
attribute - The attribute.
public double getAttributeDouble(String name,
double defaultValue)
The given default value is returned if an attribute with the given name could not be found in this node.
name - the attribute namedefaultValue - the default value
NumberFormatException - if the attribute type is ASCII but cannot be converted to a numberpublic double getAttributeDouble(String name)
An Exception is thrown if an attribute with the given name could not be found in this node.
name - the attribute name
NumberFormatException - if the attribute type is ASCII but cannot be converted to a number
IllegalArgumentException - if an attribute with the given name could not be found
public ProductData.UTC getAttributeUTC(String name,
ProductData.UTC defaultValue)
The given default value is returned if an attribute with the given name could not be found in this node.
name - the attribute namedefaultValue - the default value
public ProductData.UTC getAttributeUTC(String name)
name - the attribute name
IllegalArgumentException - if an attribute with the given name could not be found
public int getAttributeInt(String name,
int defaultValue)
The given default value is returned if an attribute with the given name could not be found in this node.
name - the attribute namedefaultValue - the default value
NumberFormatException - if the attribute type is ASCII but cannot be converted to a numberpublic int getAttributeInt(String name)
An Exception is thrown if an attribute with the given name could not be found in this node.
name - the attribute name
NumberFormatException - if the attribute type is ASCII but cannot be converted to a number
IllegalArgumentException - if an attribute with the given name could not be found
public void setAttributeInt(String name,
int value)
A new attribute with
ProductData.TYPE_INT32 is added to this node if an attribute with the given name could not be found
in this node.
name - the attribute namevalue - the new value
public void setAttributeDouble(String name,
double value)
A new attribute with
ProductData.TYPE_FLOAT64 is added to this node if an attribute with the given name could not be found
in this node.
name - the attribute namevalue - the new value
public void setAttributeUTC(String name,
ProductData.UTC value)
A new attribute with
ProductData.UTC is added to this node if an attribute with the given name could not be found
in this node.
name - the attribute namevalue - the new valuepublic String getAttributeString(String name)
An Exception is thrown if an attribute with the given name could not be found in this node.
name - the attribute name
IllegalArgumentException - if an attribute with the given name could not be found
public String getAttributeString(String name,
String defaultValue)
The given default value is returned if an attribute with the given name could not be found in this node.
name - the attribute namedefaultValue - the default value
public void setAttributeString(String name,
String value)
A new attribute with
ProductData.TYPE_ASCII is added to this node if an attribute with the given name could not be found
in this node.
name - the attribute namevalue - the new valuepublic void setModified(boolean modified)
ProductNode
setModified in class ProductNodemodified - whether or not this node is beeing marked as modified.Product.fireNodeChanged(org.esa.beam.framework.datamodel.ProductNode, java.lang.String, java.lang.Object, java.lang.Object)public void acceptVisitor(ProductVisitor visitor)
The method first visits (calls acceptVisitor for) all elements contained in this element and then
visits all attributes. Finally the method calls visitor.visit(this).
acceptVisitor in class ProductNodevisitor - the visitorpublic long getRawStorageSize(ProductSubsetDef subsetDef)
getRawStorageSize in class ProductNodesubsetDef - if not null the subset may limit the size returned
public MetadataElement createDeepClone()
public void dispose()
This method should be called only if it is for sure that this object instance will never be used again. The
results of referencing an instance of this class after a call to dispose() are undefined.
Overrides of this method should always call super.dispose(); after disposing this instance.
dispose in class ProductNode@Deprecated public void addAttributeFast(MetadataAttribute attribute)
addAttribute(MetadataAttribute) should now be fast enough
attribute - the attribute to be added, null is ignored
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||