Class Field
-
- All Implemented Interfaces:
DataObject,ReflectiveDataObject,FieldOperations,Observable
public class Field extends Part implements FieldOperations
A field definition of aMessageDef.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.haumacher.msgbuf.generator.ast.Part
Part.Visitor<R,A>
-
Nested classes/interfaces inherited from class de.haumacher.msgbuf.generator.ast.WithOptions
WithOptions.TypeKind
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_VALUE__PROPstatic StringFIELD__TYPEIdentifier for theFieldtype in JSON format.static StringREPEATED__PROPstatic StringTRANSIENT__PROPstatic StringTYPE__PROP-
Fields inherited from class de.haumacher.msgbuf.generator.ast.Part
INDEX__PROP, NAME__PROP, OWNER__PROP
-
Fields inherited from class de.haumacher.msgbuf.generator.ast.DefinitionBase
COMMENT__PROP
-
Fields inherited from class de.haumacher.msgbuf.generator.ast.WithOptions
_listener, OPTIONS__PROP
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Fieldcreate()Creates aFieldinstance.Objectget(String field)StringgetDefaultValue()The initializer value to assign to the field.TypegetType()The type of values that can be stored in this field.booleanhasDefaultValue()Checks, whethergetDefaultValue()has a value.booleanhasType()Checks, whethergetType()has a value.protected voidinternalSetDefaultValue(String value)Internal setter forgetDefaultValue()without chain call utility.protected voidinternalSetRepeated(boolean value)Internal setter forisRepeated()without chain call utility.protected voidinternalSetTransient(boolean value)Internal setter forisTransient()without chain call utility.protected voidinternalSetType(Type value)Internal setter forgetType()without chain call utility.booleanisRepeated()Whether this field contains multiple values of itsgetType().booleanisTransient()Whether this field is not serialized when a message is created.StringjsonType()WithOptions.TypeKindkind()The type code of this instance.List<String>properties()FieldputOption(String key, Option value)Adds a key value pair to theWithOptions.getOptions()map.static FieldreadField(JsonReader in)Reads a new instance from the given reader.protected voidreadField(JsonReader in, String field)Fieldself()The implementation.voidset(String field, Object value)FieldsetComment(String value)FieldsetDefaultValue(String value)FieldsetIndex(int value)FieldsetName(String value)FieldsetOptions(Map<String,Option> value)FieldsetOwner(Definition value)FieldsetRepeated(boolean value)FieldsetTransient(boolean value)FieldsetType(Type value)<R,A>
Rvisit(Part.Visitor<R,A> v, A arg)Accepts the given visitor.protected voidwriteFields(JsonWriter out)-
Methods inherited from class de.haumacher.msgbuf.generator.ast.Part
getIndex, getName, getOwner, hasOwner, internalSetIndex, internalSetName, internalSetOwner, readPart, visit
-
Methods inherited from class de.haumacher.msgbuf.generator.ast.DefinitionBase
getComment, internalSetComment, readDefinitionBase, visit
-
Methods inherited from class de.haumacher.msgbuf.generator.ast.WithOptions
getOptions, internalPutOption, internalRegisterListener, internalSetOptions, internalUnregisterListener, readWithOptions, registerListener, removeOption, unregisterListener, writeTo
-
Methods inherited from class de.haumacher.msgbuf.data.AbstractDataObject
readContent, readFields, toString, writeContent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.haumacher.msgbuf.generator.FieldOperations
container, getReverse, getReverseAnnotation, isContainer, isDerived, isRef, isReverse, isReverseOf
-
Methods inherited from interface de.haumacher.msgbuf.data.ReflectiveDataObject
transientProperties
-
-
-
-
Field Detail
-
FIELD__TYPE
public static final String FIELD__TYPE
Identifier for theFieldtype in JSON format.- See Also:
- Constant Field Values
-
TRANSIENT__PROP
public static final String TRANSIENT__PROP
- See Also:
isTransient(), Constant Field Values
-
REPEATED__PROP
public static final String REPEATED__PROP
- See Also:
isRepeated(), Constant Field Values
-
TYPE__PROP
public static final String TYPE__PROP
- See Also:
getType(), Constant Field Values
-
DEFAULT_VALUE__PROP
public static final String DEFAULT_VALUE__PROP
- See Also:
getDefaultValue(), Constant Field Values
-
-
Method Detail
-
kind
public WithOptions.TypeKind kind()
Description copied from class:WithOptionsThe type code of this instance.- Specified by:
kindin classWithOptions
-
isTransient
public final boolean isTransient()
Whether this field is not serialized when a message is created.
-
setTransient
public Field setTransient(boolean value)
- See Also:
isTransient()
-
internalSetTransient
protected final void internalSetTransient(boolean value)
Internal setter forisTransient()without chain call utility.
-
isRepeated
public final boolean isRepeated()
Whether this field contains multiple values of itsgetType().
-
setRepeated
public Field setRepeated(boolean value)
- See Also:
isRepeated()
-
internalSetRepeated
protected final void internalSetRepeated(boolean value)
Internal setter forisRepeated()without chain call utility.
-
getType
public final Type getType()
The type of values that can be stored in this field.
-
internalSetType
protected final void internalSetType(Type value)
Internal setter forgetType()without chain call utility.
-
hasType
public final boolean hasType()
Checks, whethergetType()has a value.
-
getDefaultValue
public final String getDefaultValue()
The initializer value to assign to the field.
-
setDefaultValue
public Field setDefaultValue(String value)
- See Also:
getDefaultValue()
-
internalSetDefaultValue
protected final void internalSetDefaultValue(String value)
Internal setter forgetDefaultValue()without chain call utility.
-
hasDefaultValue
public final boolean hasDefaultValue()
Checks, whethergetDefaultValue()has a value.
-
setName
public Field setName(String value)
- Overrides:
setNamein classPart- See Also:
Part.getName()
-
setIndex
public Field setIndex(int value)
- Overrides:
setIndexin classPart- See Also:
Part.getIndex()
-
setOwner
public Field setOwner(Definition value)
- Overrides:
setOwnerin classPart- See Also:
Part.getOwner()
-
setComment
public Field setComment(String value)
- Overrides:
setCommentin classPart- See Also:
DefinitionBase.getComment()
-
setOptions
public Field setOptions(Map<String,Option> value)
- Overrides:
setOptionsin classPart- See Also:
WithOptions.getOptions()
-
putOption
public Field putOption(String key, Option value)
Description copied from class:WithOptionsAdds a key value pair to theWithOptions.getOptions()map.
-
jsonType
public String jsonType()
- Specified by:
jsonTypein interfaceReflectiveDataObject
-
properties
public List<String> properties()
- Specified by:
propertiesin interfaceReflectiveDataObject- Overrides:
propertiesin classPart
-
get
public Object get(String field)
- Specified by:
getin interfaceReflectiveDataObject- Overrides:
getin classPart
-
set
public void set(String field, Object value)
- Specified by:
setin interfaceReflectiveDataObject- Overrides:
setin classPart
-
readField
public static Field readField(JsonReader in) throws IOException
Reads a new instance from the given reader.- Throws:
IOException
-
writeFields
protected void writeFields(JsonWriter out) throws IOException
- Overrides:
writeFieldsin classPart- Throws:
IOException
-
readField
protected void readField(JsonReader in, String field) throws IOException
- Overrides:
readFieldin classPart- Throws:
IOException
-
self
public Field self()
Description copied from interface:FieldOperationsThe implementation.- Specified by:
selfin interfaceFieldOperations
-
visit
public <R,A> R visit(Part.Visitor<R,A> v, A arg)
Description copied from class:PartAccepts the given visitor.
-
-