Class FieldDefinitionCollection
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<java.lang.String,T>
-
- com.thingworx.types.collections.GenericObjectCollection<T>
-
- com.thingworx.types.collections.NamedObjectCollection<FieldDefinition>
-
- com.thingworx.metadata.collections.FieldDefinitionCollection
-
- All Implemented Interfaces:
IDiffableObject
,java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.String,FieldDefinition>
@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public final class FieldDefinitionCollection extends NamedObjectCollection<FieldDefinition>
A map of field names to their associated field definitions. AFieldDefinitionCollection
supports serialization to XML and JSON, as well as creating derived data shape definitions. Fields belonging to this map can be iterated over according to their ordinality or storage order.
-
-
Constructor Summary
Constructors Constructor Description FieldDefinitionCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFieldDefinition(FieldDefinition field)
Adds a new field definition to this data shape definition.FieldDefinitionCollection
clone()
Returns a deep clone of this collection.FieldDefinition
getFieldDefinition(java.lang.String name)
Returns the field definition with the specified name.java.util.ArrayList<FieldDefinition>
getOrderedFields()
Returns a list of the field definitions in this collection using their natural order.java.util.ArrayList<FieldDefinition>
getOrderedFieldsByOrdinal()
Returns a list of field definitions in this collection using the order defined by their ordinality.DataShapeDefinition
toDataShape()
-
Methods inherited from class com.thingworx.types.collections.NamedObjectCollection
getNamesAsInfoTable, getOrderedList
-
Methods inherited from class com.thingworx.types.collections.GenericObjectCollection
containsEntity, getDescription, getName, getNames
-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Method Detail
-
getFieldDefinition
@ThingworxExtensionApiMethod(since={6,6}) public FieldDefinition getFieldDefinition(java.lang.String name)
Returns the field definition with the specified name.- Parameters:
name
- the name of the field to return- Returns:
- the specified field definition, or
null
if the field does not exist
-
addFieldDefinition
@ThingworxExtensionApiMethod(since={6,6}) public void addFieldDefinition(FieldDefinition field)
Adds a new field definition to this data shape definition.- Parameters:
field
- the field definition to add
-
toDataShape
@ThingworxExtensionApiMethod(since={6,6}) public DataShapeDefinition toDataShape()
- Returns:
- a
DataShapeDefinition
containing this collection's field definitions
-
getOrderedFields
@ThingworxExtensionApiMethod(since={6,6}) public java.util.ArrayList<FieldDefinition> getOrderedFields()
Returns a list of the field definitions in this collection using their natural order.- Returns:
- a sorted list of field definitions
-
getOrderedFieldsByOrdinal
@ThingworxExtensionApiMethod(since={6,6}) public java.util.ArrayList<FieldDefinition> getOrderedFieldsByOrdinal()
Returns a list of field definitions in this collection using the order defined by their ordinality.- Returns:
- a sorted list of field definitions
-
clone
@ThingworxExtensionApiMethod(since={6,6}) public FieldDefinitionCollection clone()
Returns a deep clone of this collection.- Overrides:
clone
in classjava.util.HashMap<java.lang.String,FieldDefinition>
- Returns:
- a clone of this collection
-
-