public class OptionalDefinition extends DataDefinition
OptionalDefinition
instance defines an optional type with
a specific element type.Constructor and Description |
---|
OptionalDefinition(DataDefinition elementType)
Constructor to create a optional-definition with the specified element
type.
|
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 |
getElementType()
Return the data-definition for the element type of this
optional-definition.
|
DataType |
getType()
Returns the
DataType for this type. |
int |
hashCode() |
OptionalValue |
newInstance()
Create and return a new
OptionalValue using this
optional definition. |
String |
toString() |
List<Message> |
validate(DataValue value)
Validates that the specified
DataValue is an instance of this
data definition. |
validInstanceOf
public OptionalDefinition(DataDefinition elementType)
elementType
- data-definition for the element of the
optional-definitionIllegalArgumentException
- if elementType
is null
public DataType getType()
DataType
for this type.getType
in class DataDefinition
DataType
for this typepublic OptionalValue newInstance()
OptionalValue
using this
optional definition.public DataDefinition getElementType()
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 the type of the optional value content if it is set/present.
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()
toString
in class DataDefinition
public void accept(DefinitionVisitor visitor)
accept
in class DataDefinition
visitor
- the visitor operating on this data-definitionCopyright © 2015. All Rights Reserved.