Class DefinitionFile
- java.lang.Object
-
- de.haumacher.msgbuf.data.AbstractDataObject
-
- de.haumacher.msgbuf.generator.ast.WithOptions
-
- de.haumacher.msgbuf.generator.ast.DefinitionFile
-
- All Implemented Interfaces:
DataObject,ReflectiveDataObject,Observable
public class DefinitionFile extends WithOptions
Representation of a.protofile with top-levelDefinitions.- See Also:
getDefinitions()
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.haumacher.msgbuf.generator.ast.WithOptions
WithOptions.TypeKind, WithOptions.Visitor<R,A>
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFINITION_FILE__TYPEIdentifier for theDefinitionFiletype in JSON format.static StringDEFINITIONS__PROPstatic StringPACKAGE__PROP-
Fields inherited from class de.haumacher.msgbuf.generator.ast.WithOptions
_listener, OPTIONS__PROP
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefinitionFile()Creates aDefinitionFileinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DefinitionFileaddDefinition(Definition value)Adds a value to thegetDefinitions()list.static DefinitionFilecreate()Creates aDefinitionFileinstance.Objectget(String field)List<Definition>getDefinitions()All definitions in this file.QNamegetPackage()The package name for all types in this file.booleanhasPackage()Checks, whethergetPackage()has a value.protected voidinternalAddDefinition(Definition value)Implementation ofaddDefinition(de.haumacher.msgbuf.generator.ast.Definition)without chain call utility.protected voidinternalSetDefinitions(List<? extends Definition> value)Internal setter forgetDefinitions()without chain call utility.protected voidinternalSetPackage(QName value)Internal setter forgetPackage()without chain call utility.StringjsonType()WithOptions.TypeKindkind()The type code of this instance.List<String>properties()DefinitionFileputOption(String key, Option value)Adds a key value pair to theWithOptions.getOptions()map.static DefinitionFilereadDefinitionFile(JsonReader in)Reads a new instance from the given reader.protected voidreadField(JsonReader in, String field)voidremoveDefinition(Definition value)Removes a value from thegetDefinitions()list.voidset(String field, Object value)DefinitionFilesetDefinitions(List<? extends Definition> value)DefinitionFilesetOptions(Map<String,Option> value)DefinitionFilesetPackage(QName value)<R,A>
Rvisit(WithOptions.Visitor<R,A> v, A arg)Accepts the given visitor.protected voidwriteFields(JsonWriter out)-
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
-
DEFINITION_FILE__TYPE
public static final String DEFINITION_FILE__TYPE
Identifier for theDefinitionFiletype in JSON format.- See Also:
- Constant Field Values
-
PACKAGE__PROP
public static final String PACKAGE__PROP
- See Also:
getPackage(), Constant Field Values
-
DEFINITIONS__PROP
public static final String DEFINITIONS__PROP
- See Also:
getDefinitions(), Constant Field Values
-
-
Constructor Detail
-
DefinitionFile
protected DefinitionFile()
Creates aDefinitionFileinstance.- See Also:
create()
-
-
Method Detail
-
create
public static DefinitionFile create()
Creates aDefinitionFileinstance.
-
kind
public WithOptions.TypeKind kind()
Description copied from class:WithOptionsThe type code of this instance.- Specified by:
kindin classWithOptions
-
getPackage
public final QName getPackage()
The package name for all types in this file.
-
setPackage
public DefinitionFile setPackage(QName value)
- See Also:
getPackage()
-
internalSetPackage
protected final void internalSetPackage(QName value)
Internal setter forgetPackage()without chain call utility.
-
hasPackage
public final boolean hasPackage()
Checks, whethergetPackage()has a value.
-
getDefinitions
public final List<Definition> getDefinitions()
All definitions in this file.
-
setDefinitions
public DefinitionFile setDefinitions(List<? extends Definition> value)
- See Also:
getDefinitions()
-
internalSetDefinitions
protected final void internalSetDefinitions(List<? extends Definition> value)
Internal setter forgetDefinitions()without chain call utility.
-
addDefinition
public DefinitionFile addDefinition(Definition value)
Adds a value to thegetDefinitions()list.
-
internalAddDefinition
protected final void internalAddDefinition(Definition value)
Implementation ofaddDefinition(de.haumacher.msgbuf.generator.ast.Definition)without chain call utility.
-
removeDefinition
public final void removeDefinition(Definition value)
Removes a value from thegetDefinitions()list.
-
setOptions
public DefinitionFile setOptions(Map<String,Option> value)
- Overrides:
setOptionsin classWithOptions- See Also:
WithOptions.getOptions()
-
putOption
public DefinitionFile putOption(String key, Option value)
Description copied from class:WithOptionsAdds a key value pair to theWithOptions.getOptions()map.- Overrides:
putOptionin classWithOptions
-
jsonType
public String jsonType()
-
properties
public List<String> properties()
- Specified by:
propertiesin interfaceReflectiveDataObject- Overrides:
propertiesin classWithOptions
-
get
public Object get(String field)
- Specified by:
getin interfaceReflectiveDataObject- Overrides:
getin classWithOptions
-
set
public void set(String field, Object value)
- Specified by:
setin interfaceReflectiveDataObject- Overrides:
setin classWithOptions
-
readDefinitionFile
public static DefinitionFile readDefinitionFile(JsonReader in) throws IOException
Reads a new instance from the given reader.- Throws:
IOException
-
writeFields
protected void writeFields(JsonWriter out) throws IOException
- Overrides:
writeFieldsin classWithOptions- Throws:
IOException
-
readField
protected void readField(JsonReader in, String field) throws IOException
- Overrides:
readFieldin classWithOptions- Throws:
IOException
-
visit
public <R,A> R visit(WithOptions.Visitor<R,A> v, A arg)
Description copied from class:WithOptionsAccepts the given visitor.- Specified by:
visitin classWithOptions
-
-