Package io.protostuff.compiler.model
Class Enum
- java.lang.Object
-
- io.protostuff.compiler.model.AbstractElement
-
- io.protostuff.compiler.model.AbstractDescriptor
-
- io.protostuff.compiler.model.Enum
-
- All Implemented Interfaces:
Descriptor,Element,FieldType,Type,UserType
public class Enum extends AbstractDescriptor implements UserType
Enum node of proto file.- Author:
- Kostiantyn Shchepanovskyi
-
-
Field Summary
Fields Modifier and Type Field Description protected List<EnumConstant>constantsprotected StringfullyQualifiedNameprotected UserTypeContainerparentprotected Protoprotoprotected List<String>reservedFieldNamesprotected List<Range>reservedFieldRanges-
Fields inherited from class io.protostuff.compiler.model.AbstractDescriptor
name, options
-
Fields inherited from class io.protostuff.compiler.model.AbstractElement
comments, sourceCodeLocation
-
-
Constructor Summary
Constructors Constructor Description Enum(UserTypeContainer parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConstant(EnumConstant value)voidaddReservedFieldName(String fieldName)voidaddReservedFieldRange(Range range)StringgetCanonicalName()ReturnsFieldType.getFullyQualifiedName()without leading dot.EnumConstantgetConstant(String name)Get enum constant by it's name.Set<String>getConstantNames()Returns a list of all enum constant names.List<EnumConstant>getConstants()DescriptorTypegetDescriptorType()StringgetFullyQualifiedName()Returns fully qualified name for this user type.UserTypeContainergetParent()ProtogetProto()List<String>getReservedFieldNames()List<Range>getReservedFieldRanges()booleanisEnum()Test if this type is enum.booleanisMap()Test if this type is map.booleanisMessage()Test if this type is message.booleanisNested()Test if this type is nested (declared inside of other message).booleanisScalar()Test if this type is scalar.voidsetConstants(List<EnumConstant> constants)voidsetFullyQualifiedName(String fullyQualifiedName)voidsetProto(Proto proto)StringtoString()-
Methods inherited from class io.protostuff.compiler.model.AbstractDescriptor
getName, getOptions, setName
-
Methods inherited from class io.protostuff.compiler.model.AbstractElement
addComment, getCommentLines, getComments, getSourceCodeLocation, setComments, setSourceCodeLocation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.protostuff.compiler.model.Descriptor
getOptions
-
Methods inherited from interface io.protostuff.compiler.model.Element
getCommentLines, getComments, getSourceCodeLocation
-
-
-
-
Field Detail
-
parent
protected final UserTypeContainer parent
-
constants
protected List<EnumConstant> constants
-
proto
protected Proto proto
-
fullyQualifiedName
protected String fullyQualifiedName
-
-
Constructor Detail
-
Enum
public Enum(UserTypeContainer parent)
-
-
Method Detail
-
getConstants
public List<EnumConstant> getConstants()
-
setConstants
public void setConstants(List<EnumConstant> constants)
-
getConstant
public EnumConstant getConstant(String name)
Get enum constant by it's name.
-
addConstant
public void addConstant(EnumConstant value)
-
getDescriptorType
public DescriptorType getDescriptorType()
- Specified by:
getDescriptorTypein interfaceDescriptor
-
isScalar
public boolean isScalar()
Description copied from interface:FieldTypeTest if this type is scalar.
-
isEnum
public boolean isEnum()
Description copied from interface:FieldTypeTest if this type is enum.
-
isMessage
public boolean isMessage()
Description copied from interface:FieldTypeTest if this type is message.
-
getFullyQualifiedName
public String getFullyQualifiedName()
Description copied from interface:UserTypeReturns fully qualified name for this user type. It always starts with dot.- Specified by:
getFullyQualifiedNamein interfaceFieldType- Specified by:
getFullyQualifiedNamein interfaceType- Specified by:
getFullyQualifiedNamein interfaceUserType
-
setFullyQualifiedName
public void setFullyQualifiedName(String fullyQualifiedName)
- Specified by:
setFullyQualifiedNamein interfaceUserType
-
getCanonicalName
public String getCanonicalName()
Description copied from interface:FieldTypeReturnsFieldType.getFullyQualifiedName()without leading dot.- Specified by:
getCanonicalNamein interfaceFieldType- Specified by:
getCanonicalNamein interfaceType
-
isMap
public boolean isMap()
Description copied from interface:FieldTypeTest if this type is map.
-
getParent
public UserTypeContainer getParent()
-
isNested
public boolean isNested()
Description copied from interface:UserTypeTest if this type is nested (declared inside of other message).
-
addReservedFieldRange
public void addReservedFieldRange(Range range)
- Specified by:
addReservedFieldRangein interfaceUserType
-
addReservedFieldName
public void addReservedFieldName(String fieldName)
- Specified by:
addReservedFieldNamein interfaceUserType
-
getReservedFieldRanges
public List<Range> getReservedFieldRanges()
- Specified by:
getReservedFieldRangesin interfaceUserType
-
getReservedFieldNames
public List<String> getReservedFieldNames()
- Specified by:
getReservedFieldNamesin interfaceUserType
-
-