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 unset
OptionalValue. |
String |
toString() |
List<Message> |
validate(DataValue value)
Validates that the specified
DataValue is an instance of this
data definition. |
validInstanceOfpublic OptionalDefinition(DataDefinition elementType)
elementType - data-definition for the element of the
optional-definitionIllegalArgumentException - if elementType is nullpublic DataType getType()
DataDefinitionDataType for this type.getType in class DataDefinitionDataType for this typepublic OptionalValue newInstance()
OptionalValue.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 DataDefinitionvalue - the DataValue to validatepublic void completeValue(DataValue value)
DataDefinitioncompleteValue in class DataDefinitionvalue - the value to checkpublic String toString()
toString in class DataDefinitionpublic void accept(DefinitionVisitor visitor)
accept in class DataDefinitionvisitor - the visitor operating on this data-definitionCopyright © 2023. All rights reserved.