Package net.morimekta.providence.model
Class FieldType
- java.lang.Object
-
- net.morimekta.providence.model.FieldType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<FieldType>
,Decl
,FieldType_OrBuilder
,PMessage<FieldType>
,PMessageOrBuilder<FieldType>
,PValue<FieldType>
,BinaryWriter
,net.morimekta.util.Stringable
@Generated(value="net.morimekta.providence:providence-generator-java", comments="java:serializable") @Immutable public class FieldType extends java.lang.Object implements Decl, FieldType_OrBuilder, PMessage<FieldType>, java.lang.Comparable<FieldType>, java.io.Serializable, BinaryWriter
For fields: (<key>:)? (required|optional)? <type> <name> (= <default_value>)? For const: const <type> <name> = <default_value>Fields without key is assigned values ranging from 65335 and down (2^16-1) in order of appearance. Because of the "in order of appearance" the field *must* be filled by the IDL parser.
Consts are always given the key '0'.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FieldType._Builder
For fields: (<key>:)?static class
FieldType._Field
-
Field Summary
Fields Modifier and Type Field Description static PStructDescriptor<FieldType>
kDescriptor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
asString()
Pure string representation of content.static FieldType._Builder
builder()
Make ap_model.FieldType
builder.int
compareTo(FieldType other)
PStructDescriptor<FieldType>
descriptor()
boolean
equals(java.lang.Object o)
<T> T
get(int key)
java.util.Map<java.lang.String,java.lang.String>
getAnnotations()
java.lang.String
getDefaultValue()
java.lang.String
getDocumentation()
Documentation for the specific declaration.int
getId()
java.lang.String
getName()
Name of the type, constant or service.FieldRequirement
getRequirement()
java.lang.String
getType()
boolean
has(int key)
boolean
hasAnnotations()
boolean
hasDefaultValue()
boolean
hasDocumentation()
int
hashCode()
boolean
hasId()
boolean
hasName()
boolean
hasRequirement()
boolean
hasType()
FieldType._Builder
mutate()
Get a builder that extends the current object.int
numAnnotations()
java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>
optionalAnnotations()
java.util.Optional<java.lang.String>
optionalDefaultValue()
java.util.Optional<java.lang.String>
optionalDocumentation()
Documentation for the specific declaration.java.util.Optional<FieldRequirement>
optionalRequirement()
static PStructDescriptorProvider<FieldType>
provider()
java.lang.String
toString()
int
writeBinary(net.morimekta.util.io.BigEndianBinaryWriter writer)
Write the current message to the binary writer.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.PMessageOrBuilder
toBuilder, toMessage
-
-
-
-
Field Detail
-
kDescriptor
public static final PStructDescriptor<FieldType> kDescriptor
-
-
Method Detail
-
hasDocumentation
public boolean hasDocumentation()
- Specified by:
hasDocumentation
in interfaceDecl
- Returns:
- If documentation is present.
-
getDocumentation
public java.lang.String getDocumentation()
Description copied from interface:Decl
Documentation for the specific declaration.- Specified by:
getDocumentation
in interfaceDecl
- Returns:
- The
documentation
value
-
optionalDocumentation
@Nonnull public java.util.Optional<java.lang.String> optionalDocumentation()
Description copied from interface:Decl
Documentation for the specific declaration.- Specified by:
optionalDocumentation
in interfaceDecl
- Returns:
- Optional of the
documentation
field value.
-
hasId
public boolean hasId()
- Specified by:
hasId
in interfaceFieldType_OrBuilder
- Returns:
- If id is present.
-
getId
public int getId()
- Specified by:
getId
in interfaceFieldType_OrBuilder
- Returns:
- The
id
value
-
hasRequirement
public boolean hasRequirement()
- Specified by:
hasRequirement
in interfaceFieldType_OrBuilder
- Returns:
- If requirement is present.
-
getRequirement
public FieldRequirement getRequirement()
- Specified by:
getRequirement
in interfaceFieldType_OrBuilder
- Returns:
- The
requirement
value
-
optionalRequirement
@Nonnull public java.util.Optional<FieldRequirement> optionalRequirement()
- Specified by:
optionalRequirement
in interfaceFieldType_OrBuilder
- Returns:
- Optional of the
requirement
field value.
-
hasType
public boolean hasType()
- Specified by:
hasType
in interfaceFieldType_OrBuilder
- Returns:
- If type is present.
-
getType
@Nonnull public java.lang.String getType()
- Specified by:
getType
in interfaceFieldType_OrBuilder
- Returns:
- The
type
value
-
hasName
public boolean hasName()
-
getName
@Nonnull public java.lang.String getName()
Description copied from interface:Decl
Name of the type, constant or service.
-
hasDefaultValue
public boolean hasDefaultValue()
- Specified by:
hasDefaultValue
in interfaceFieldType_OrBuilder
- Returns:
- If default_value is present.
-
getDefaultValue
public java.lang.String getDefaultValue()
- Specified by:
getDefaultValue
in interfaceFieldType_OrBuilder
- Returns:
- The
default_value
value
-
optionalDefaultValue
@Nonnull public java.util.Optional<java.lang.String> optionalDefaultValue()
- Specified by:
optionalDefaultValue
in interfaceFieldType_OrBuilder
- Returns:
- Optional of the
default_value
field value.
-
numAnnotations
public int numAnnotations()
- Specified by:
numAnnotations
in interfaceFieldType_OrBuilder
- Returns:
- Number of entries in annotations.
-
hasAnnotations
public boolean hasAnnotations()
- Specified by:
hasAnnotations
in interfaceFieldType_OrBuilder
- Returns:
- If annotations is present.
-
getAnnotations
public java.util.Map<java.lang.String,java.lang.String> getAnnotations()
- Specified by:
getAnnotations
in interfaceFieldType_OrBuilder
- Returns:
- The
annotations
value
-
optionalAnnotations
@Nonnull public java.util.Optional<java.util.Map<java.lang.String,java.lang.String>> optionalAnnotations()
- Specified by:
optionalAnnotations
in interfaceFieldType_OrBuilder
- Returns:
- Optional of the
annotations
field value.
-
has
public boolean has(int key)
- Specified by:
has
in interfacePMessageOrBuilder<FieldType>
- Parameters:
key
- The key of the field.- Returns:
- Whether the field is present.
-
get
public <T> T get(int key)
- Specified by:
get
in interfacePMessageOrBuilder<FieldType>
- Type Parameters:
T
- The return type.- Parameters:
key
- The key of the field.- Returns:
- The value of the field.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
asString
@Nonnull public java.lang.String asString()
Description copied from interface:PMessage
Pure string representation of content. Does not contain type info.
-
compareTo
public int compareTo(FieldType other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<FieldType>
-
writeBinary
public int writeBinary(net.morimekta.util.io.BigEndianBinaryWriter writer) throws java.io.IOException
Description copied from interface:BinaryWriter
Write the current message to the binary writer. NOTE: This method is not intended to be used directly. Instead use theBinarySerializer.serialize(OutputStream, PMessageOrBuilder)
call.- Specified by:
writeBinary
in interfaceBinaryWriter
- Parameters:
writer
- The binary writer to write to.- Returns:
- The number of bytes written.
- Throws:
java.io.IOException
- If it failed to write the message for any reason.
-
mutate
@Nonnull public FieldType._Builder mutate()
Description copied from interface:PMessage
Get a builder that extends the current object.
-
provider
@Nonnull public static PStructDescriptorProvider<FieldType> provider()
-
descriptor
@Nonnull public PStructDescriptor<FieldType> descriptor()
- Specified by:
descriptor
in interfacePMessageOrBuilder<FieldType>
- Specified by:
descriptor
in interfacePValue<FieldType>
-
builder
public static FieldType._Builder builder()
Make ap_model.FieldType
builder.- Returns:
- The builder instance.
-
-