Class EnumDef
- java.lang.Object
-
- de.haumacher.msgbuf.data.AbstractDataObject
-
- de.haumacher.msgbuf.generator.ast.WithOptions
-
- de.haumacher.msgbuf.generator.ast.DefinitionBase
-
- de.haumacher.msgbuf.generator.ast.Definition
-
- de.haumacher.msgbuf.generator.ast.EnumDef
-
- All Implemented Interfaces:
DataObject,ReflectiveDataObject,Observable
public class EnumDef extends Definition
Definitionof an enumeration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.haumacher.msgbuf.generator.ast.Definition
Definition.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 StringCONSTANTS__PROPstatic StringENUM_DEF__TYPEIdentifier for theEnumDeftype in JSON format.-
Fields inherited from class de.haumacher.msgbuf.generator.ast.Definition
FILE__PROP, NAME__PROP, OUTER__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 EnumDefaddConstant(Constant value)Adds a value to thegetConstants()list.static EnumDefcreate()Creates aEnumDefinstance.Objectget(String field)List<Constant>getConstants()All enum constants of this enumerationprotected voidinternalAddConstant(Constant value)Implementation ofaddConstant(de.haumacher.msgbuf.generator.ast.Constant)without chain call utility.protected voidinternalSetConstants(List<? extends Constant> value)Internal setter forgetConstants()without chain call utility.StringjsonType()WithOptions.TypeKindkind()The type code of this instance.List<String>properties()EnumDefputOption(String key, Option value)Adds a key value pair to theWithOptions.getOptions()map.static EnumDefreadEnumDef(JsonReader in)Reads a new instance from the given reader.protected voidreadField(JsonReader in, String field)voidremoveConstant(Constant value)Removes a value from thegetConstants()list.voidset(String field, Object value)EnumDefsetComment(String value)EnumDefsetConstants(List<? extends Constant> value)EnumDefsetFile(DefinitionFile value)EnumDefsetName(String value)EnumDefsetOptions(Map<String,Option> value)EnumDefsetOuter(MessageDef value)<R,A>
Rvisit(Definition.Visitor<R,A> v, A arg)Accepts the given visitor.protected voidwriteFields(JsonWriter out)-
Methods inherited from class de.haumacher.msgbuf.generator.ast.Definition
getFile, getName, getOuter, hasFile, hasOuter, internalSetFile, internalSetName, internalSetOuter, readDefinition, 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.data.ReflectiveDataObject
transientProperties
-
-
-
-
Field Detail
-
ENUM_DEF__TYPE
public static final String ENUM_DEF__TYPE
Identifier for theEnumDeftype in JSON format.- See Also:
- Constant Field Values
-
CONSTANTS__PROP
public static final String CONSTANTS__PROP
- See Also:
getConstants(), Constant Field Values
-
-
Method Detail
-
kind
public WithOptions.TypeKind kind()
Description copied from class:WithOptionsThe type code of this instance.- Specified by:
kindin classWithOptions
-
setConstants
public EnumDef setConstants(List<? extends Constant> value)
- See Also:
getConstants()
-
internalSetConstants
protected final void internalSetConstants(List<? extends Constant> value)
Internal setter forgetConstants()without chain call utility.
-
addConstant
public EnumDef addConstant(Constant value)
Adds a value to thegetConstants()list.
-
internalAddConstant
protected final void internalAddConstant(Constant value)
Implementation ofaddConstant(de.haumacher.msgbuf.generator.ast.Constant)without chain call utility.
-
removeConstant
public final void removeConstant(Constant value)
Removes a value from thegetConstants()list.
-
setName
public EnumDef setName(String value)
- Overrides:
setNamein classDefinition- See Also:
Definition.getName()
-
setFile
public EnumDef setFile(DefinitionFile value)
- Overrides:
setFilein classDefinition- See Also:
Definition.getFile()
-
setOuter
public EnumDef setOuter(MessageDef value)
- Overrides:
setOuterin classDefinition- See Also:
Definition.getOuter()
-
setComment
public EnumDef setComment(String value)
- Overrides:
setCommentin classDefinition- See Also:
DefinitionBase.getComment()
-
setOptions
public EnumDef setOptions(Map<String,Option> value)
- Overrides:
setOptionsin classDefinition- See Also:
WithOptions.getOptions()
-
putOption
public EnumDef putOption(String key, Option value)
Description copied from class:WithOptionsAdds a key value pair to theWithOptions.getOptions()map.- Overrides:
putOptionin classDefinition
-
jsonType
public String jsonType()
-
properties
public List<String> properties()
- Specified by:
propertiesin interfaceReflectiveDataObject- Overrides:
propertiesin classDefinition
-
get
public Object get(String field)
- Specified by:
getin interfaceReflectiveDataObject- Overrides:
getin classDefinition
-
set
public void set(String field, Object value)
- Specified by:
setin interfaceReflectiveDataObject- Overrides:
setin classDefinition
-
readEnumDef
public static EnumDef readEnumDef(JsonReader in) throws IOException
Reads a new instance from the given reader.- Throws:
IOException
-
writeFields
protected void writeFields(JsonWriter out) throws IOException
- Overrides:
writeFieldsin classDefinition- Throws:
IOException
-
readField
protected void readField(JsonReader in, String field) throws IOException
- Overrides:
readFieldin classDefinition- Throws:
IOException
-
visit
public <R,A> R visit(Definition.Visitor<R,A> v, A arg)
Description copied from class:DefinitionAccepts the given visitor.- Specified by:
visitin classDefinition
-
-