Package com.mindee.parsing.v2.field
Class DynamicField
- java.lang.Object
-
- com.mindee.parsing.v2.field.DynamicField
-
public class DynamicField extends Object
Dynamically-typed field (simple / object / list).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DynamicField.FieldType
Possible field kinds.
-
Constructor Summary
Constructors Constructor Description DynamicField()
DynamicField(DynamicField.FieldType type, SimpleField simpleField, ListField listField, ObjectField objectField)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
<T extends BaseField>
TgetField(Class<T> type)
Returns the field as the specified class.ListField
getListField()
ObjectField
getObjectField()
SimpleField
getSimpleField()
DynamicField.FieldType
getType()
Type of the wrapped field.int
hashCode()
static DynamicField
of(ListField value)
static DynamicField
of(ObjectField value)
static DynamicField
of(SimpleField value)
String
toString()
-
-
-
Constructor Detail
-
DynamicField
public DynamicField(DynamicField.FieldType type, SimpleField simpleField, ListField listField, ObjectField objectField)
-
DynamicField
public DynamicField()
-
-
Method Detail
-
of
public static DynamicField of(SimpleField value)
-
of
public static DynamicField of(ObjectField value)
-
of
public static DynamicField of(ListField value)
-
getSimpleField
public SimpleField getSimpleField() throws IllegalStateException
- Throws:
IllegalStateException
-
getListField
public ListField getListField() throws IllegalStateException
- Throws:
IllegalStateException
-
getObjectField
public ObjectField getObjectField() throws IllegalStateException
- Throws:
IllegalStateException
-
getField
public <T extends BaseField> T getField(Class<T> type) throws IllegalArgumentException
Returns the field as the specified class.- Type Parameters:
T
- the type of field to return- Parameters:
type
- the class representing the desired field type- Throws:
IllegalArgumentException
- if the requested type is not SimpleField, ListField, or ObjectFieldIllegalStateException
- if the field's internal type does not match the requested type
-
getType
public DynamicField.FieldType getType()
Type of the wrapped field.
-
canEqual
protected boolean canEqual(Object other)
-
-