Class Definition
- 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
-
- All Implemented Interfaces:
DataObject,ReflectiveDataObject,Observable
- Direct Known Subclasses:
EnumDef,MessageDef
public abstract class Definition extends DefinitionBase
Base class of a definition in aDefinitionFile.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDefinition.Visitor<R,A>Visitor interface for theDefinitionhierarchy.-
Nested classes/interfaces inherited from class de.haumacher.msgbuf.generator.ast.WithOptions
WithOptions.TypeKind
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILE__PROPstatic StringNAME__PROPstatic StringOUTER__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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefinition()Creates aDefinitioninstance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Objectget(String field)DefinitionFilegetFile()Reference back to theDefinitionFilethat contains this definition.StringgetName()The name of this definition.MessageDefgetOuter()TheMessageDefthat contains this inner .booleanhasFile()Checks, whethergetFile()has a value.booleanhasOuter()Checks, whethergetOuter()has a value.protected voidinternalSetFile(DefinitionFile value)Internal setter forgetFile()without chain call utility.protected voidinternalSetName(String value)Internal setter forgetName()without chain call utility.protected voidinternalSetOuter(MessageDef value)Internal setter forgetOuter()without chain call utility.List<String>properties()DefinitionputOption(String key, Option value)Adds a key value pair to theWithOptions.getOptions()map.static DefinitionreadDefinition(JsonReader in)Reads a new instance from the given reader.protected voidreadField(JsonReader in, String field)voidset(String field, Object value)DefinitionsetComment(String value)DefinitionsetFile(DefinitionFile value)DefinitionsetName(String value)DefinitionsetOptions(Map<String,Option> value)DefinitionsetOuter(MessageDef value)abstract <R,A>
Rvisit(Definition.Visitor<R,A> v, A arg)Accepts the given visitor.<R,A>
Rvisit(DefinitionBase.Visitor<R,A> v, A arg)Accepts the given visitor.protected voidwriteFields(JsonWriter out)-
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, kind, 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
jsonType, transientProperties
-
-
-
-
Field Detail
-
NAME__PROP
public static final String NAME__PROP
- See Also:
getName(), Constant Field Values
-
FILE__PROP
public static final String FILE__PROP
- See Also:
getFile(), Constant Field Values
-
OUTER__PROP
public static final String OUTER__PROP
- See Also:
getOuter(), Constant Field Values
-
-
Constructor Detail
-
Definition
protected Definition()
Creates aDefinitioninstance.
-
-
Method Detail
-
getName
public final String getName()
The name of this definition.
-
setName
public Definition setName(String value)
- See Also:
getName()
-
internalSetName
protected final void internalSetName(String value)
Internal setter forgetName()without chain call utility.
-
getFile
public final DefinitionFile getFile()
Reference back to theDefinitionFilethat contains this definition.
-
setFile
public Definition setFile(DefinitionFile value)
- See Also:
getFile()
-
internalSetFile
protected final void internalSetFile(DefinitionFile value)
Internal setter forgetFile()without chain call utility.
-
hasFile
public final boolean hasFile()
Checks, whethergetFile()has a value.
-
getOuter
public final MessageDef getOuter()
TheMessageDefthat contains this inner .The value is
nullfor top-level defintions, seegetFile().
-
setOuter
public Definition setOuter(MessageDef value)
- See Also:
getOuter()
-
internalSetOuter
protected final void internalSetOuter(MessageDef value)
Internal setter forgetOuter()without chain call utility.
-
hasOuter
public final boolean hasOuter()
Checks, whethergetOuter()has a value.
-
setComment
public Definition setComment(String value)
- Overrides:
setCommentin classDefinitionBase- See Also:
DefinitionBase.getComment()
-
setOptions
public Definition setOptions(Map<String,Option> value)
- Overrides:
setOptionsin classDefinitionBase- See Also:
WithOptions.getOptions()
-
putOption
public Definition putOption(String key, Option value)
Description copied from class:WithOptionsAdds a key value pair to theWithOptions.getOptions()map.- Overrides:
putOptionin classDefinitionBase
-
properties
public List<String> properties()
- Specified by:
propertiesin interfaceReflectiveDataObject- Overrides:
propertiesin classDefinitionBase
-
get
public Object get(String field)
- Specified by:
getin interfaceReflectiveDataObject- Overrides:
getin classDefinitionBase
-
set
public void set(String field, Object value)
- Specified by:
setin interfaceReflectiveDataObject- Overrides:
setin classDefinitionBase
-
readDefinition
public static Definition readDefinition(JsonReader in) throws IOException
Reads a new instance from the given reader.- Throws:
IOException
-
writeFields
protected void writeFields(JsonWriter out) throws IOException
- Overrides:
writeFieldsin classDefinitionBase- Throws:
IOException
-
readField
protected void readField(JsonReader in, String field) throws IOException
- Overrides:
readFieldin classDefinitionBase- Throws:
IOException
-
visit
public abstract <R,A> R visit(Definition.Visitor<R,A> v, A arg)
Accepts the given visitor.
-
visit
public final <R,A> R visit(DefinitionBase.Visitor<R,A> v, A arg)
Description copied from class:DefinitionBaseAccepts the given visitor.- Specified by:
visitin classDefinitionBase
-
-