Enum PPrimitive

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<PPrimitive>, PDescriptor

    public enum PPrimitive
    extends java.lang.Enum<PPrimitive>
    implements PDescriptor
    Descriptors for primitive types.

    These are the basic types used in the thrift structure except containers.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static PPrimitive findByName​(java.lang.String name)
      Find primitive by name.
      java.lang.Object getDefaultValue()  
      java.lang.String getName()
      The name of the type is the Identifier string from the IDL.
      java.lang.reflect.Type getNativeType()
      Get the java native type for the given primitive.
      java.lang.String getProgramName()
      The package name is derived form the .thrift file name that is parsed or if read from serialized format is explicit.
      java.lang.String getQualifiedName​(java.lang.String programContext)
      This will return the qualified name of the type given the program context.
      PType getType()  
      boolean isNativePrimitive()  
      PPrimitiveProvider provider()
      Get the descriptor provider for the primitive.
      java.lang.String toString()  
      static PPrimitive valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static PPrimitive[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static PPrimitive[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (PPrimitive c : PPrimitive.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static PPrimitive valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • 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.Enum<PPrimitive>
      • getType

        @Nonnull
        public PType getType()
        Specified by:
        getType in interface PDescriptor
        Returns:
        Get the field type.
      • 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​(@Nonnull
                                            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.