|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.netcdf.Attribute
Attributes are similar to "IndexedProperties" in the lingo of java beans. They have a name, type and an array of values. The array is often of length 1, degenerating into a simple property. The array should never be length 0. An Attribute object is used to contain netcdf "metadata", like units of a measurable quantity or its valid range.
These attributes have fixed values over their lifetime; no setValue() methods are provided.
Instances which have same name and same value elements are equal. We override hashCode() and equals() to be consistent with this semantic.
| Constructor Summary | |
Attribute(String name,
double value)
Construct simple numeric attribute. |
|
Attribute(String name,
Number value)
Construct simple numeric attribute. |
|
Attribute(String name,
Object theValue)
Construct an array valued Attribute. |
|
Attribute(String name,
String theValue)
Construct a string valued attribute. |
|
| Method Summary | |
(package private) static Object |
arrayClone(Object src)
Why isn't this in java.lang.reflect.Array as native? |
boolean |
equals(Object oo)
Instances which have same name and same value elements are equal. |
Object |
get(int index)
Retrieve indexed value. |
Class |
getComponentType()
If the value represents an array type, returns the Class object representing the component type of the array; otherwise returns null. |
int |
getLength()
If the value represents an array type, returns the length of the value array; otherwise return String.length of the String value. |
String |
getName()
Returns the name of this Attribute. |
Number |
getNumericValue()
Retrieve simple numeric value. |
Number |
getNumericValue(int index)
Retrieve indexed numeric value. |
String |
getStringValue()
Retrieve String value. |
Object |
getValue()
Retrieve the value in its most general form. |
int |
hashCode()
Instances which have same name and same value elements are equal. |
boolean |
isString()
If the value is an instance of String, return true
otherwise returns false |
(package private) static Class |
primitiveClass(Number nn)
Use reflection to find out the TYPE (primitive class) corresponding to a Number. |
void |
toCdl(StringBuffer buf)
Format as CDL. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Attribute(String name,
Number value)
name - String which is to be the name of this Attributevalue - A Number to be the Attribute value
public Attribute(String name,
double value)
name - String which is to be the name of this Attributevalue - A double to be the Attribute value
public Attribute(String name,
String theValue)
name - String which is to be the name of this AttributetheValue - The value
public Attribute(String name,
Object theValue)
name - String which is to be the name of this AttributetheValue - The value, an array of primitives. The primitive
type must be netcdf encodeable.| Method Detail |
public int hashCode()
public boolean equals(Object oo)
public String toString()
public final String getName()
getName in interface Namedpublic Object getValue()
isString()public String getStringValue()
ClassCastException - if this is not String valued.isString()public Object get(int index)
index - int which is the index into the value array.
value[index]public Number getNumericValue(int index)
index - int which is the index into the value array.
value[index]public Number getNumericValue()
getNumericValue(0)
public boolean isString()
true
otherwise returns false
public Class getComponentType()
Class.getComponentType()public int getLength()
public void toCdl(StringBuffer buf)
buf - StringBuffer into which to writestatic Object arrayClone(Object src)
static Class primitiveClass(Number nn)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||