Class PPrimitive
- java.lang.Object
-
- net.morimekta.providence.descriptor.PPrimitive
-
- All Implemented Interfaces:
PDescriptor
public class PPrimitive extends java.lang.Object implements PDescriptor
Descriptors for primitive types.These are the basic types used in the thrift structure except containers.
-
-
Field Summary
Fields Modifier and Type Field Description static PPrimitiveBINARYstatic PPrimitiveBOOLstatic PPrimitiveBYTEstatic PPrimitiveDOUBLEstatic PPrimitiveI16static PPrimitiveI32static PPrimitiveI64static PPrimitiveSTRINGstatic PPrimitiveVOID
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static PPrimitivefindByName(java.lang.String name)Find primitive by name.java.lang.ObjectgetDefaultValue()java.lang.StringgetName()The name of the type is the Identifier string from the IDL.java.lang.reflect.TypegetNativeType()Get the java native type for the given primitive.java.lang.StringgetProgramName()The package name is derived form the .thrift file name that is parsed or if read from serialized format is explicit.java.lang.StringgetQualifiedName(java.lang.String programContext)This will return the qualified name of the type given the program context.PTypegetType()inthashCode()booleanisNativePrimitive()PPrimitiveProviderprovider()Get the descriptor provider for the primitive.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.descriptor.PDescriptor
getQualifiedName
-
-
-
-
Field Detail
-
VOID
public static final PPrimitive VOID
-
BOOL
public static final PPrimitive BOOL
-
BYTE
public static final PPrimitive BYTE
-
I16
public static final PPrimitive I16
-
I32
public static final PPrimitive I32
-
I64
public static final PPrimitive I64
-
DOUBLE
public static final PPrimitive DOUBLE
-
STRING
public static final PPrimitive STRING
-
BINARY
public static final PPrimitive BINARY
-
-
Method Detail
-
provider
@Nonnull public PPrimitiveProvider provider()
Get the descriptor provider for the primitive.- Returns:
- The descriptor provider.
-
getProgramName
public java.lang.String getProgramName()
Description copied from interface:PDescriptorThe package name is derived form the .thrift file name that is parsed or if read from serialized format is explicit. Note that there may be package name conflicts globally.- Specified by:
getProgramNamein interfacePDescriptor- Returns:
- The program name of the type. If empty the type is not in any named program, e.g. primitives.
-
getName
@Nonnull public java.lang.String getName()
Description copied from interface:PDescriptorThe name of the type is the Identifier string from the IDL.- Specified by:
getNamein interfacePDescriptor- Returns:
- The name of the type. Not including package.
-
getQualifiedName
@Nonnull public java.lang.String getQualifiedName(java.lang.String programContext)
Description copied from interface:PDescriptorThis will return the qualified name of the type given the program context.- Specified by:
getQualifiedNamein interfacePDescriptor- Parameters:
programContext- The program which the type should be referenced from.- Returns:
- The qualified name of the type. Including program if not matching with programContext.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getType
@Nonnull public PType getType()
- Specified by:
getTypein interfacePDescriptor- Returns:
- Get the field type.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getDefaultValue
public java.lang.Object getDefaultValue()
- Specified by:
getDefaultValuein interfacePDescriptor- Returns:
- The default value for the type used for default and required fields. Note that some primitive types don't support null values, and will have methods returning a default value regardless of the field required value setting.
-
isNativePrimitive
public boolean isNativePrimitive()
- Returns:
- Returns false if the primitive type allows null values. If this method returns true, getter and setter methods will have parameters and return type with the native primitive type, not it's boxed variant.
-
findByName
public static PPrimitive findByName(java.lang.String name)
Find primitive by name.- Parameters:
name- The name of the primitive.- Returns:
- The primitive descriptor.
-
getNativeType
public java.lang.reflect.Type getNativeType()
Get the java native type for the given primitive.- Returns:
- The java type.
-
-