Class CField<M extends PMessage<M>>
- java.lang.Object
-
- net.morimekta.providence.reflect.contained.CField<M>
-
- Type Parameters:
M
- The message type.
- All Implemented Interfaces:
PField<M>
,CAnnotatedDescriptor
public class CField<M extends PMessage<M>> extends java.lang.Object implements PField<M>, CAnnotatedDescriptor
Description of a single contained field. Part of the message descriptor.
-
-
Field Summary
Fields Modifier and Type Field Description static CField<?>[]
EMPTY_ARRAY
-
Constructor Summary
Constructors Constructor Description CField(java.lang.String docs, int id, PRequirement requirement, java.lang.String name, PDescriptorProvider typeProvider, PStructDescriptorProvider<?> argumentsProvider, PValueProvider<?> defaultValue, java.util.Map<java.lang.String,java.lang.String> annotations, PDescriptorProvider implementing)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.util.Set<java.lang.String>
getAnnotations()
Get set of available annotations.java.lang.String
getAnnotationValue(java.lang.String name)
Get the given annotation value.PStructDescriptor<?>
getArgumentsType()
If present, is the params type to be used for parameterizable field content, e.g. with GraphQL.java.lang.Object
getDefaultValue()
PDescriptor
getDescriptor()
java.lang.String
getDocumentation()
The type comment is the last block of comment written before the type declaration.int
getId()
java.lang.String
getName()
java.lang.String
getPojoName()
PRequirement
getRequirement()
boolean
hasAnnotation(java.lang.String name)
Get the given annotation value.boolean
hasDefaultValue()
int
hashCode()
PMessageDescriptor<M>
onMessageType()
The message type the field is on.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.reflect.contained.CAnnotatedDescriptor
getAnnotationValue, hasAnnotation
-
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final CField<?>[] EMPTY_ARRAY
-
-
Constructor Detail
-
CField
public CField(@Nullable java.lang.String docs, int id, @Nonnull PRequirement requirement, @Nonnull java.lang.String name, @Nonnull PDescriptorProvider typeProvider, @Nullable PStructDescriptorProvider<?> argumentsProvider, @Nullable PValueProvider<?> defaultValue, @Nullable java.util.Map<java.lang.String,java.lang.String> annotations, @Nullable PDescriptorProvider implementing)
-
-
Method Detail
-
getDocumentation
public java.lang.String getDocumentation()
Description copied from interface:CAnnotatedDescriptor
The type comment is the last block of comment written before the type declaration. Comments on the same line, after the declaration is ignored.- Specified by:
getDocumentation
in interfaceCAnnotatedDescriptor
- Returns:
- The comment string containing all formatting (not including the comment delimiter and the leading space.
-
getId
public int getId()
-
getRequirement
@Nonnull public PRequirement getRequirement()
- Specified by:
getRequirement
in interfacePField<M extends PMessage<M>>
- Returns:
- How the field is required for validity.
-
getDescriptor
@Nonnull public PDescriptor getDescriptor()
- Specified by:
getDescriptor
in interfacePField<M extends PMessage<M>>
- Returns:
- The type descriptor for the field data type.
-
getArgumentsType
public PStructDescriptor<?> getArgumentsType()
Description copied from interface:PField
If present, is the params type to be used for parameterizable field content, e.g. with GraphQL.- Specified by:
getArgumentsType
in interfacePField<M extends PMessage<M>>
- Returns:
- The params type, or null if not parameterizable.
-
getName
@Nonnull public java.lang.String getName()
-
getPojoName
@Nonnull public java.lang.String getPojoName()
- Specified by:
getPojoName
in interfacePField<M extends PMessage<M>>
- Returns:
- The field's pojo name.
-
hasDefaultValue
public boolean hasDefaultValue()
- Specified by:
hasDefaultValue
in interfacePField<M extends PMessage<M>>
- Returns:
- Whether the field has an explicit default value.
-
getDefaultValue
public java.lang.Object getDefaultValue()
- Specified by:
getDefaultValue
in interfacePField<M extends PMessage<M>>
- Returns:
- The default value or null if none. This should return value also where the field has an implicit default value, e.g. numerical types.
-
getAnnotations
@Nonnull public java.util.Set<java.lang.String> getAnnotations()
Description copied from interface:CAnnotatedDescriptor
Get set of available annotations.- Specified by:
getAnnotations
in interfaceCAnnotatedDescriptor
- Returns:
- The annotation set.
-
hasAnnotation
public boolean hasAnnotation(@Nonnull java.lang.String name)
Description copied from interface:CAnnotatedDescriptor
Get the given annotation value.- Specified by:
hasAnnotation
in interfaceCAnnotatedDescriptor
- Parameters:
name
- Name of annotation.- Returns:
- If the annotation is present.
-
getAnnotationValue
public java.lang.String getAnnotationValue(@Nonnull java.lang.String name)
Description copied from interface:CAnnotatedDescriptor
Get the given annotation value.- Specified by:
getAnnotationValue
in interfaceCAnnotatedDescriptor
- Parameters:
name
- Name of annotation.- Returns:
- The annotation value or null.
-
onMessageType
@Nonnull public PMessageDescriptor<M> onMessageType()
Description copied from interface:PField
The message type the field is on.- Specified by:
onMessageType
in interfacePField<M extends PMessage<M>>
- Returns:
- The fields message type.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-