@Immutable
public class FieldDescriptor
extends java.lang.Object
DescriptorProtos.FieldDescriptorProto, which describes a single field in a message.
i.e:
message TestMsg {
optional int64 field = 1; // Descriptor for this
}| Constructor and Description |
|---|
FieldDescriptor(io.protobufx.protoc.gen.spring.generator.FileDescriptorProcessingContext context,
MessageDescriptor parentMessage,
com.google.protobuf.DescriptorProtos.FieldDescriptorProto fieldDescriptorProto,
java.util.Map<java.lang.String,java.lang.Boolean> duplicateNameMap) |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
formatFieldName(java.lang.String name)
Format the name of a field from snake case to camel case.
|
java.lang.String |
getComment() |
java.util.Optional<AbstractDescriptor> |
getContentMessage()
Returns the descriptor for the non-base message type of this field.
|
java.lang.String |
getName()
Get the non-suffixed, camelcase name to use to refer to the field.
|
java.util.Optional<java.lang.String> |
getOneofName()
Get the camelcase name of the enclosing oneof, if this field is declared inside a oneof.
|
com.google.protobuf.DescriptorProtos.FieldDescriptorProto |
getProto() |
java.lang.String |
getSuffixedName()
Get the suffixed, camelcase name to use to refer to the field.
|
java.lang.String |
getType()
Get the full Java type of the field.
|
java.lang.String |
getTypeName()
Get the name of the type for the field.
|
boolean |
isList() |
boolean |
isMapField() |
boolean |
isProto3Syntax() |
boolean |
isRequired() |
public FieldDescriptor(@Nonnull
io.protobufx.protoc.gen.spring.generator.FileDescriptorProcessingContext context,
@Nonnull
MessageDescriptor parentMessage,
@Nonnull
com.google.protobuf.DescriptorProtos.FieldDescriptorProto fieldDescriptorProto,
@Nonnull
java.util.Map<java.lang.String,java.lang.Boolean> duplicateNameMap)
context - File context.parentMessage - The message within which the field is declared.fieldDescriptorProto - file proto.duplicateNameMap - A map containing the names of fields that end up being duplicates
in the message the field is defined in. Names end up as duplicates
when the only thing that distinguishes them is the underscore.@Nonnull
public static java.lang.String formatFieldName(@Nonnull
java.lang.String name)
name - The name of the field.@Nonnull public java.lang.String getSuffixedName()
@Nonnull public java.lang.String getName()
@Nonnull public com.google.protobuf.DescriptorProtos.FieldDescriptorProto getProto()
@Nonnull public java.lang.String getComment()
public boolean isProto3Syntax()
public boolean isRequired()
public java.util.Optional<java.lang.String> getOneofName()
Optional containing the name of the enclosing oneof. An empty optional
if the field is not enclosed in a oneof.@Nonnull public java.lang.String getTypeName()
MessageDescriptor.public boolean isMapField()
@Nonnull public java.lang.String getType()
getTypeName(),
but will convert "repeated" and "map" fields to List and Map of the right type of objects.public boolean isList()
@Nonnull public java.util.Optional<AbstractDescriptor> getContentMessage()