@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public class FieldDefinition extends NamedObject implements IAspectContainer, java.lang.Cloneable
A definition for a data field. Fields are used primarily as the storage mechanism in DataShapeDefinition
, analogous to
PropertyDefinition
in Thing
s, ThingTemplate
s, and ThingShape
s. Fields are also used in services for
defining the input parameters and the result.
Field definitions can be organized according to ordinality and assigned special behavioral properties called "aspects". An aspect is a
key-value pair where the value conforms to one of the primitives in the BaseTypes
enumeration. The aspects that can be assigned
to a field definition are defined in the Aspects
class.
NAME_COMPARATOR
Constructor and Description |
---|
FieldDefinition()
Constructs a new unnamed field definition with the default base type of STRING. |
FieldDefinition(java.lang.String name,
BaseTypes baseType)
Constructs a new field definition with the specified name and base type. |
FieldDefinition(java.lang.String name,
BaseTypes baseType,
AspectCollection aspects)
Constructs a new field definition with the specified name, base type, and aspects. |
FieldDefinition(java.lang.String name,
java.lang.String description)
Constructs a new field definition with the specified name and description. |
FieldDefinition(java.lang.String name,
java.lang.String description,
BaseTypes baseType)
Constructs a new field definition with the specified name, description, and base type. |
FieldDefinition(java.lang.String name,
java.lang.String description,
BaseTypes baseType,
AspectCollection aspects)
Constructs a new field definition with the specified name, description, base type, and aspects. |
Modifier and Type | Method and Description |
---|---|
boolean |
aspectsMatch(AspectCollection aspects)
Determines whether or not the aspects assigned to this field are equivalent to the aspects in the provided collection. |
FieldDefinition |
clone()
Creates a deep clone of this field definition. |
AspectCollection |
getAspects()
Returns the collection of aspects belonging to this field. |
BaseTypes |
getBaseType()
Returns the base type assigned to this field definition. |
java.lang.String |
getDataShapeName()
Returns the data shape name assigned to the ASPECT_DATASHAPE aspect,
if the base type for this field is set to INFOTABLE . |
IPrimitiveType |
getDefaultValue()
Returns the default value assigned to this field, if one has been defined according to the ASPECT_DEFAULTVALUE aspect. |
java.lang.Integer |
getOrdinal()
Returns the ordinal value assigned to this field. |
boolean |
hasDataShape()
Determines if, when the base type of this field is an INFOTABLE , a data shape has been assigned. |
boolean |
hasDefaultValue()
|
boolean |
isContentCrawlerEntry()
Determines if, when the base type of this field is an INFOTABLE , the contents of the info table will be derived from a
content crawler entry. |
boolean |
isDataTableEntry()
Determines if, when the base type of this field is an INFOTABLE , the contents of the info table will be derived from a data
table entry. |
boolean |
isPrimaryKey()
|
java.lang.Boolean |
isPrivate()
|
boolean |
isQueryParameter()
Determines if, the service parameter is marked as a query parameter |
java.lang.Boolean |
isRequired()
|
boolean |
isStreamEntry()
Determines if, when the base type of this field is an INFOTABLE , the contents of the info table will be derived from a stream
entry. |
void |
setAspects(AspectCollection value)
Replaces all aspects on this field with the aspects in the specified collection. |
void |
setBaseType(BaseTypes baseType)
Assigns the specified base type to this field. |
void |
setOrdinal(java.lang.Integer ordinal)
Sets the ordinal value for this field. |
getDescription, getName, setDescription, setName, toValueCollection
@ThingworxExtensionApiMethod(since={6,6}) public FieldDefinition()
@ThingworxExtensionApiMethod(since={6,6}) public FieldDefinition(java.lang.String name, java.lang.String description)
name
- the namedescription
- the description@ThingworxExtensionApiMethod(since={6,6}) public FieldDefinition(java.lang.String name, java.lang.String description, BaseTypes baseType)
name
- the namedescription
- the descriptionbaseType
- the base type@ThingworxExtensionApiMethod(since={7,1}) public FieldDefinition(java.lang.String name, BaseTypes baseType, AspectCollection aspects)
name
- the namebaseType
- the base typeaspects
- a collection of aspects belonging to this field@ThingworxExtensionApiMethod(since={7,1}) public FieldDefinition(java.lang.String name, java.lang.String description, BaseTypes baseType, AspectCollection aspects)
name
- the namedescription
- the descriptionbaseType
- the base typeaspects
- a collection of aspects belonging to this field@ThingworxExtensionApiMethod(since={6,6}) public FieldDefinition(java.lang.String name, BaseTypes baseType)
name
- the namebaseType
- the base type@ThingworxExtensionApiMethod(since={6,6}) public BaseTypes getBaseType()
@ThingworxExtensionApiMethod(since={6,6}) public void setBaseType(BaseTypes baseType)
baseType
- the base type to assign to this field@ThingworxExtensionApiMethod(since={6,6}) public java.lang.Integer getOrdinal()
@ThingworxExtensionApiMethod(since={6,6}) public void setOrdinal(java.lang.Integer ordinal)
ordinal
- the new ordinal value@ThingworxExtensionApiMethod(since={6,6}) public java.lang.Boolean isPrivate()
true
if this field has the aspect and it is set to true
, false
otherwise@ThingworxExtensionApiMethod(since={6,6}) public java.lang.Boolean isRequired()
true
if this field has the aspect and it is set to true
, false
otherwise@ThingworxExtensionApiMethod(since={6,6}) public boolean isPrimaryKey()
true
if this field has the aspect and it is set to true
, false
otherwise@ThingworxExtensionApiMethod(since={6,6}) public IPrimitiveType getDefaultValue()
ASPECT_DEFAULTVALUE
aspect.null
if none has been defined@ThingworxExtensionApiMethod(since={6,6}) public boolean hasDefaultValue()
true
if this field has a default value@ThingworxExtensionApiMethod(since={6,6}) public void setAspects(AspectCollection value)
value
- the aspects that will be assigned to this field@ThingworxExtensionApiMethod(since={6,6}) public AspectCollection getAspects()
@ThingworxExtensionApiMethod(since={6,6}) public boolean aspectsMatch(AspectCollection aspects)
aspects
- a collection of aspects to compare againsttrue
if the aspects are equivalent@ThingworxExtensionApiMethod(since={6,6}) public FieldDefinition clone()
clone
in class java.lang.Object
@ThingworxExtensionApiMethod(since={6,6}) public boolean hasDataShape()
INFOTABLE
, a data shape has been assigned.true
if the base type is set to INFOTABLE
and a value is set to the
ASPECT_DATASHAPE
aspect@ThingworxExtensionApiMethod(since={6,6}) public boolean isStreamEntry()
INFOTABLE
, the contents of the info table will be derived from a stream
entry.true
if the base type is set to INFOTABLE
and the
ASPECT_ISSTREAMENTRY
aspect is set to true
@ThingworxExtensionApiMethod(since={6,6}) public boolean isDataTableEntry()
INFOTABLE
, the contents of the info table will be derived from a data
table entry.true
if the base type is set to INFOTABLE
and the
ASPECT_ISDATATABLEENTRY
aspect is set to true
@ThingworxExtensionApiMethod(since={8,3}) public boolean isQueryParameter()
true
ASPECT_ISQUERYPARAMETER
aspect is set to
true
@ThingworxExtensionApiMethod(since={8,0}) public boolean isContentCrawlerEntry()
INFOTABLE
, the contents of the info table will be derived from a
content crawler entry.true
if the base type is set to INFOTABLE
and the
ASPECT_ISCONTENTCRAWLERENTRY
aspect is set to
true
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String getDataShapeName()
ASPECT_DATASHAPE
aspect,
if the base type for this field is set to INFOTABLE
.INFOTABLE
, or null
if no data shape
name has been assigned or the base type is not INFOTABLE