public class Attribute extends CDMNode
Modifier and Type | Class and Description |
---|---|
static class |
Attribute.Builder
A builder for Attributes
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
SPECIALS
Deprecated.
move to jni.Nc4Iosp
|
annotations, dodsname, group, immutable, parentstruct, shortName, sort
Modifier | Constructor and Description |
---|---|
|
Attribute(Parameter param)
Deprecated.
Use Attribute.builder()
|
protected |
Attribute(java.lang.String name)
Deprecated.
Use Attribute.builder()
|
|
Attribute(java.lang.String name,
Array values)
Deprecated.
Use Attribute.builder()
|
|
Attribute(java.lang.String name,
Attribute from)
Deprecated.
Use Attribute.toBuilder().build();
|
|
Attribute(java.lang.String name,
DataType dataType)
Deprecated.
Use Attribute.builder()
|
|
Attribute(java.lang.String name,
java.util.List values)
Deprecated.
Use Attribute.builder()
|
|
Attribute(java.lang.String name,
java.util.List values,
boolean isUnsigned)
Deprecated.
Use Attribute.builder()
|
|
Attribute(java.lang.String name,
java.lang.Number val)
Create a scalar, signed, numeric-valued Attribute.
|
|
Attribute(java.lang.String name,
java.lang.Number val,
boolean isUnsigned)
Deprecated.
Use Attribute.builder()
|
|
Attribute(java.lang.String name,
java.lang.String val)
Create a String-valued Attribute.
|
Modifier and Type | Method and Description |
---|---|
static Attribute.Builder |
builder()
Create an Attribute builder.
|
static Attribute.Builder |
builder(java.lang.String name)
Create an Attribute builder with the given Attribute name.
|
boolean |
equals(java.lang.Object o)
Instances which have same content are equal.
|
DataType |
getDataType()
Get the data type of the Attribute value.
|
EnumTypedef |
getEnumType()
Get the EnumTypedef of the Attribute value, if DataType is an ENUM.
|
int |
getLength()
Get the length of the array of values
|
java.lang.String |
getName()
Get the Attribute name.
|
java.lang.Number |
getNumericValue()
Retrieve numeric value.
|
java.lang.Number |
getNumericValue(int index)
Retrieve a numeric value by index.
|
java.lang.String |
getStringValue()
Retrieve String value; only call if isString() is true.
|
java.lang.String |
getStringValue(int index)
Retrieve ith String value; only call if isString() is true.
|
java.lang.Object |
getValue(int index)
Get the value as an Object.
|
Array |
getValues()
Get the value as an Array.
|
int |
hashCode()
Override Object.hashCode() to implement equals.
|
boolean |
isArray()
True if value is an array (getLength() > 1)
|
static boolean |
isspecial(Attribute a)
Deprecated.
move to jni.Nc4Iosp
|
boolean |
isString()
True if value is of type String and not null.
|
static java.util.Map<java.lang.String,Attribute> |
makeMap(java.util.List<Attribute> atts)
Deprecated.
do not use
|
void |
setDataType(DataType dt)
Deprecated.
Use Attribute.builder()
|
void |
setEnumType(EnumTypedef en)
Deprecated.
Use Attribute.builder()
|
void |
setName(java.lang.String name)
Deprecated.
Use Attribute.builder()
|
void |
setValues(Array arr)
Deprecated.
Use Attribute.builder()
|
void |
setValues(java.util.List values)
Deprecated.
Use Attribute.builder()
|
Attribute.Builder |
toBuilder()
Turn into a mutable Builder.
|
java.lang.String |
toString() |
java.lang.String |
toString(boolean strict)
Deprecated.
use CDLWriter
|
protected void |
writeCDL(java.util.Formatter f,
boolean strict,
java.lang.String parentname)
Deprecated.
use CDLWriter
|
annotate, annotation, getDODSName, getFullName, getFullNameEscaped, getGroup, getImmutable, getParentGroup, getParentStructure, getShortName, getSort, isMemberOfStructure, localhash, setDODSName, setImmutable, setParentGroup, setParentStructure, setShortName, setSort, unwrap
@Deprecated public static final java.lang.String[] SPECIALS
@Deprecated public Attribute(java.lang.String name, Attribute from)
name
- name of new Attributefrom
- copy value from here.public Attribute(java.lang.String name, java.lang.String val)
name
- name of Attributeval
- value of Attributepublic Attribute(java.lang.String name, java.lang.Number val)
name
- name of Attributeval
- value of Attribute@Deprecated public Attribute(java.lang.String name, java.lang.Number val, boolean isUnsigned)
name
- name of Attributeval
- value of AttributeisUnsigned
- if value is unsigned, used only for integer types.@Deprecated public Attribute(java.lang.String name, Array values)
name
- name of attributevalues
- array of values.@Deprecated public Attribute(java.lang.String name, DataType dataType)
@Deprecated public Attribute(java.lang.String name, java.util.List values)
@Deprecated public Attribute(java.lang.String name, java.util.List values, boolean isUnsigned)
name
- name of attributevalues
- list of values. must be String or Number, must all be the same type, and have at least 1 memberisUnsigned
- if the data type is unsigned.@Deprecated public Attribute(Parameter param)
param
- copy info from here.@Deprecated protected Attribute(java.lang.String name)
name
- name of Attribute@Deprecated public static java.util.Map<java.lang.String,Attribute> makeMap(java.util.List<Attribute> atts)
atts
- list of attributes@Deprecated public static boolean isspecial(Attribute a)
public java.lang.String getName()
public DataType getDataType()
@Deprecated public void setDataType(DataType dt)
@Nullable public EnumTypedef getEnumType()
@Deprecated public void setEnumType(EnumTypedef en)
public boolean isArray()
public int getLength()
@Nullable public Array getValues()
@Nullable public java.lang.Object getValue(int index)
index
- which indexpublic boolean isString()
@Nullable public java.lang.String getStringValue()
isString()
@Nullable public java.lang.String getStringValue(int index)
index
- which indexisString()
@Nullable public java.lang.Number getNumericValue()
getNumericValue(0)
@Nullable public java.lang.Number getNumericValue(int index)
index
- the index into the value array.value[index]
, or null if its a non-parseable String or
the index is out of range.public java.lang.String toString()
toString
in class java.lang.Object
@Deprecated public java.lang.String toString(boolean strict)
strict
- if true, create strict CDL, escaping names@Deprecated protected void writeCDL(java.util.Formatter f, boolean strict, java.lang.String parentname)
f
- write into thisstrict
- if true, create strict CDL, escaping names@Deprecated public void setValues(java.util.List values)
@Deprecated public void setValues(Array arr)
arr
- value of Attribute@Deprecated public void setName(java.lang.String name)
name
- name of attributepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public Attribute.Builder toBuilder()
public static Attribute.Builder builder()
public static Attribute.Builder builder(java.lang.String name)