Class 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.

    • 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: PDescriptor
        The 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:
        getProgramName in interface PDescriptor
        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: PDescriptor
        The name of the type is the Identifier string from the IDL.
        Specified by:
        getName in interface PDescriptor
        Returns:
        The name of the type. Not including package.
      • getQualifiedName

        @Nonnull
        public java.lang.String getQualifiedName​(java.lang.String programContext)
        Description copied from interface: PDescriptor
        This will return the qualified name of the type given the program context.
        Specified by:
        getQualifiedName in interface PDescriptor
        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:
        toString in class java.lang.Object
      • getType

        @Nonnull
        public PType getType()
        Specified by:
        getType in interface PDescriptor
        Returns:
        Get the field type.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getDefaultValue

        public java.lang.Object getDefaultValue()
        Specified by:
        getDefaultValue in interface PDescriptor
        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.