public class StructType extends Type
Modifier and Type | Class and Description |
---|---|
static class |
StructType.Field
Represent a field.
|
Constructor and Description |
---|
StructType(NamespaceKey key)
Constructor.
|
StructType(java.lang.String name)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addField(StructType.Field field)
Add a field.
|
boolean |
areEqual(java.lang.Object value1,
java.lang.Object value2)
Return true if two values are considered as equal for this type.
|
void |
clearFields()
Clear the fields of the structure.
|
java.util.List<java.lang.Object> |
copyValue(java.lang.Object value)
Copy the current value and return it.
|
int |
countFields()
Return the number of fields.
|
boolean |
equals(java.lang.Object obj) |
java.util.List<java.lang.Object> |
getDefaultValue()
Return the default structure for this structure type.
|
StructType |
getExtendedType()
Return the type that this type extends.
|
StructType.Field |
getField(int position)
Return the field at a specified position.
|
StructType.Field |
getField(java.lang.String name)
Return the field of a specified name.
|
int |
getFieldPosition(java.lang.String name)
Return the position of a specified field.
|
java.util.Map<java.lang.String,StructType.Field> |
getFields()
Return the fields sorted by their name.
|
java.util.List<StructType.Field> |
getFieldsList()
Return the list of fields.
|
java.lang.Object |
getFieldValue(java.lang.String field,
java.lang.Object value)
Return the value of a field.
|
java.util.List<java.lang.Object> |
getFieldValueAsArray(java.lang.String field,
java.lang.Object value)
Return the value of a field as an array.
|
boolean |
getFieldValueAsBoolean(java.lang.String field,
java.lang.Object value)
Return the value of a field as a boolean.
|
char |
getFieldValueAsChar(java.lang.String field,
java.lang.Object value)
Return the value of a field as a char.
|
Data<?> |
getFieldValueAsData(java.lang.String field,
java.lang.Object value)
Return the value of a field as a Data.
|
double |
getFieldValueAsDouble(java.lang.String field,
java.lang.Object value)
Return the value of a field as a double.
|
double |
getFieldValueAsDouble(java.lang.String field,
java.lang.Object value,
short unit)
Return the value of a field as a double, in a specified unit.
|
float |
getFieldValueAsFloat(java.lang.String field,
java.lang.Object value)
Return the value of a field as a float.
|
float |
getFieldValueAsFloat(java.lang.String field,
java.lang.Object value,
short unit)
Return the value of a field as a float, in a specified unit.
|
int |
getFieldValueAsInt(java.lang.String field,
java.lang.Object value)
Return the value of a field as an int.
|
long |
getFieldValueAsLong(java.lang.String field,
java.lang.Object value)
Return the value of a field as an long.
|
long |
getFieldValueAsLong(java.lang.String field,
java.lang.Object value,
short unit)
Return the value of a field as an long.
|
short |
getFieldValueAsShort(java.lang.String field,
java.lang.Object value)
Return the value of a field as a short.
|
java.lang.String |
getFieldValueAsString(java.lang.String field,
java.lang.Object value)
Return the value of a field as a String.
|
java.util.List<java.lang.Object> |
getFieldValueAsStructure(java.lang.String field,
java.lang.Object value)
Return the value of a field as an array.
|
java.net.URL |
getFieldValueAsURL(java.lang.String field,
java.lang.Object value)
Return the value of a field as an URL.
|
java.lang.Object |
getInstanceFromValue(java.lang.Object value,
java.lang.Class<?> clazz)
Set the value of a structure of the specified type from the fields as an instance object.
|
java.util.List<java.lang.Object> |
getNonEmptyDefaultValue()
Return a non empty type default value.
|
Data.Structure |
getValueAsData(java.lang.Object value)
Return a value as a Data.
|
java.lang.String |
getValueAsString(java.lang.Object value)
Return a value as a String.
|
java.util.List<java.lang.Object> |
getValueFromInstance(java.lang.Object instance)
Return the value of a structure of the specified type from the fields of an instance object.
|
static StructType |
getVoid()
Return an empty Structure type, which contains no field.
|
boolean |
hasField(java.lang.String name)
Return true if the Structure has a field of a specified name.
|
int |
hashCode() |
boolean |
isAbstract()
Return true if the type is abstract.
|
boolean |
isSupportingValue(java.lang.Object value)
Return true if the specified value is supported.
|
void |
lockDefinition()
Lock the fields definition of this type.
|
void |
setAbstract(boolean isAbstract)
Set if the type is abstract.
|
void |
setExtendedType(StructType type)
Set the type that this type extends.
|
boolean |
setFieldValue(java.lang.String field,
java.lang.Object values,
java.lang.Object value)
Set the value of a field.
|
boolean |
setFieldValueAsBoolean(java.lang.String field,
java.lang.Object values,
boolean value)
Set the value of a field.
|
boolean |
setFieldValueAsChar(java.lang.String field,
java.lang.Object values,
char value)
Set the value of a field as a char.
|
boolean |
setFieldValueAsDouble(java.lang.String field,
java.lang.Object values,
double value)
Set the value of a field as a double.
|
boolean |
setFieldValueAsDouble(java.lang.String field,
java.lang.Object values,
double value,
short unit)
Set the value of a field as a double, with a specified unit.
|
boolean |
setFieldValueAsFile(java.lang.String field,
java.lang.Object values,
java.io.File value)
Set the value of a field as a File.
|
boolean |
setFieldValueAsFloat(java.lang.String field,
java.lang.Object values,
float value)
Set the value of a field as a float.
|
boolean |
setFieldValueAsFloat(java.lang.String field,
java.lang.Object values,
float value,
short unit)
Set the value of a field as a float, with a specified unit.
|
boolean |
setFieldValueAsInt(java.lang.String field,
java.lang.Object values,
int value)
Set the value of a field as an int.
|
boolean |
setFieldValueAsLong(java.lang.String field,
java.lang.Object values,
long value)
Set the value of a field as a long.
|
boolean |
setFieldValueAsShort(java.lang.String field,
java.lang.Object values,
short value)
Set the value of a field as a short.
|
boolean |
setFieldValueAsString(java.lang.String field,
java.lang.Object values,
java.lang.String value)
Set the value of a field as a String.
|
boolean |
setFieldValueAsURL(java.lang.String field,
java.lang.Object values,
java.net.URL value)
Set the value of a field as an URL.
|
createData, getDefaultValue, getDescription, getKey, getName, getNamespace, getNamespaceAsString, getTerminalType, getUnit, getValueAsBoolean, getValueAsByte, getValueAsChar, getValueAsDouble, getValueAsDouble, getValueAsFloat, getValueAsFloat, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, getValueAsShort, setDescription, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getFullName
public StructType(java.lang.String name)
name
- the type namepublic StructType(NamespaceKey key)
key
- the type keypublic static StructType getVoid()
public void setAbstract(boolean isAbstract)
isAbstract
- true if the type is abstractpublic boolean isAbstract()
isAbstract
in class Type
public void setExtendedType(StructType type)
type
- the typepublic StructType getExtendedType()
getExtendedType
in class Type
public boolean isSupportingValue(java.lang.Object value)
isSupportingValue
in class Type
value
- the valuepublic java.util.List<java.lang.Object> getDefaultValue()
getDefaultValue
in class Type
public java.util.List<java.lang.Object> getNonEmptyDefaultValue()
getNonEmptyDefaultValue
in class Type
public boolean areEqual(java.lang.Object value1, java.lang.Object value2)
public java.util.List<java.lang.Object> copyValue(java.lang.Object value)
public Data.Structure getValueAsData(java.lang.Object value)
getValueAsData
in class Type
value
- the valuepublic java.lang.String getValueAsString(java.lang.Object value)
getValueAsString
in class Type
value
- the valuepublic void lockDefinition()
public void clearFields()
public java.util.List<StructType.Field> getFieldsList()
public int countFields()
public boolean hasField(java.lang.String name)
name
- the field namepublic java.util.Map<java.lang.String,StructType.Field> getFields()
public StructType.Field getField(int position)
position
- the field positionpublic StructType.Field getField(java.lang.String name)
name
- the field namepublic int getFieldPosition(java.lang.String name)
name
- the field namepublic void addField(StructType.Field field)
field
- the fieldpublic java.util.List<java.lang.Object> getValueFromInstance(java.lang.Object instance)
getValueFromInstance
in class Type
instance
- the instance objectpublic java.lang.Object getInstanceFromValue(java.lang.Object value, java.lang.Class<?> clazz)
getInstanceFromValue
in class Type
value
- the structure valueclazz
- the Classpublic boolean setFieldValue(java.lang.String field, java.lang.Object values, java.lang.Object value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to set.public boolean setFieldValueAsBoolean(java.lang.String field, java.lang.Object values, boolean value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsInt(java.lang.String field, java.lang.Object values, int value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsLong(java.lang.String field, java.lang.Object values, long value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsChar(java.lang.String field, java.lang.Object values, char value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsShort(java.lang.String field, java.lang.Object values, short value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsFloat(java.lang.String field, java.lang.Object values, float value, short unit)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setunit
- the unitpublic boolean setFieldValueAsFloat(java.lang.String field, java.lang.Object values, float value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsDouble(java.lang.String field, java.lang.Object values, double value, short unit)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setunit
- the unitpublic boolean setFieldValueAsDouble(java.lang.String field, java.lang.Object values, double value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsString(java.lang.String field, java.lang.Object values, java.lang.String value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsFile(java.lang.String field, java.lang.Object values, java.io.File value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean setFieldValueAsURL(java.lang.String field, java.lang.Object values, java.net.URL value)
field
- the fieldvalues
- the structure value. Note that this must be a List, the method will return false if this is not a
List.value
- the field value to setpublic boolean getFieldValueAsBoolean(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return false if this is not a
List.public int getFieldValueAsInt(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.public long getFieldValueAsLong(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.public long getFieldValueAsLong(java.lang.String field, java.lang.Object value, short unit)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.public char getFieldValueAsChar(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.public short getFieldValueAsShort(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.public float getFieldValueAsFloat(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.public float getFieldValueAsFloat(java.lang.String field, java.lang.Object value, short unit)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.unit
- the unitpublic double getFieldValueAsDouble(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.public double getFieldValueAsDouble(java.lang.String field, java.lang.Object value, short unit)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return 0 if this is not a List.unit
- the unitpublic java.lang.String getFieldValueAsString(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return an empty String if this is
not a List.public java.net.URL getFieldValueAsURL(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return an empty String if this is
not a List.public java.util.List<java.lang.Object> getFieldValueAsArray(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return an empty String if this is
not a List.public java.util.List<java.lang.Object> getFieldValueAsStructure(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return an empty String if this is
not a List.public Data<?> getFieldValueAsData(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return null if this is not a
List.public java.lang.Object getFieldValue(java.lang.String field, java.lang.Object value)
field
- the fieldvalue
- the structure value. Note that this must be a List, the method will return null if this is not a
List.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright ©2017-2023 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence