Interface PField
-
- All Known Implementing Classes:
Any._Field
,CConst
,CField
,ConstType._Field
,Declaration._Field
,Empty._Field
,EnumType._Field
,EnumValue._Field
,FieldType._Field
,FilePos._Field
,FunctionType._Field
,MessageType._Field
,PApplicationException._Field
,ProgramMeta._Field
,ProgramType._Field
,ServiceType._Field
,TypedefType._Field
public interface PField
Field descriptor. All struct variants contains a set of fields. This interface describes the properties each field has. It is an interface so the fields themselves may be implemented as an enum.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static java.lang.String
asString(PField field)
asString helper for fields.java.lang.Object
getDefaultValue()
PDescriptor
getDescriptor()
int
getId()
java.lang.String
getName()
PRequirement
getRequirement()
default PType
getType()
boolean
hasDefaultValue()
-
-
-
Method Detail
-
getId
int getId()
- Returns:
- The field numeric ID or key.
-
getRequirement
@Nonnull PRequirement getRequirement()
- Returns:
- How the field is required for validity.
-
getType
@Nonnull default PType getType()
- Returns:
- The data type of the field.
-
getDescriptor
@Nonnull PDescriptor getDescriptor()
- Returns:
- The type descriptor for the field data type.
-
getName
@Nonnull java.lang.String getName()
- Returns:
- The field name (original).
-
hasDefaultValue
boolean hasDefaultValue()
- Returns:
- Whether the field has an explicit default value.
-
getDefaultValue
java.lang.Object getDefaultValue()
- 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.
-
asString
static java.lang.String asString(PField field)
asString helper for fields.- Parameters:
field
- The field to make string of.- Returns:
- The field asString.
-
-