public class StructDefinition extends DataDefinition
Constructor and Description |
---|
StructDefinition(String name,
Map<String,DataDefinition> fields)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(DefinitionVisitor visitor)
Applies a visitor to this data-definition.
|
void |
completeValue(DataValue value)
Check the value to see if the data-definition can fill in any missing
data before validation
|
boolean |
equals(Object other) |
DataDefinition |
getField(String field) |
Set<String> |
getFieldNames() |
String |
getName() |
DataType |
getType()
Returns the
DataType for this type. |
boolean |
hasField(String field) |
int |
hashCode() |
StructValue |
newInstance() |
String |
toString() |
List<Message> |
validate(DataValue value)
Validates that the specified
DataValue is an instance of this
data definition. |
validInstanceOf
public StructDefinition(String name, Map<String,DataDefinition> fields)
name
- name for the structure; must not be null
fields
- field names and definitions for the structure;
must not be null
IllegalArgumentException
- if some of the arguments or the
values in fields
is null
public DataType getType()
DataDefinition
DataType
for this type.getType
in class DataDefinition
DataType
for this typepublic String getName()
public DataDefinition getField(String field)
public boolean hasField(String field)
public StructValue newInstance()
public List<Message> validate(DataValue value)
DataValue
is an instance of this
data definition.
Validates that supplied value
is not null
and it's type matches the type of this definition.
In addition, validates that value
's name matches
this
definition name and value
's fields
are valid for this
definition fields.
validate
in class DataDefinition
value
- the DataValue
to validatepublic void completeValue(DataValue value)
DataDefinition
completeValue
in class DataDefinition
value
- the value to checkpublic String toString()
DataDefinition
toString
in class DataDefinition
public void accept(DefinitionVisitor visitor)
DataDefinition
accept
in class DataDefinition
visitor
- the visitor operating on this data-definitionCopyright © 2015. All Rights Reserved.