Enum Class Primitive

java.lang.Object
java.lang.Enum<Primitive>
dk.mada.jaxrs.model.types.Primitive
All Implemented Interfaces:
Type, Serializable, Comparable<Primitive>, Constable

public enum Primitive extends Enum<Primitive> implements Type
Primitive types of the java language (plus String).
  • Enum Constant Details

    • BOOLEAN

      public static final Primitive BOOLEAN
      The boolean.
    • NOFORMAT_INT

      public static final Primitive NOFORMAT_INT
      An integer of unknown format. Generator decides how to render this.
      See Also:
    • BYTE

      public static final Primitive BYTE
      The byte.
    • SHORT

      public static final Primitive SHORT
      The short. This cannot be represented by spec's type/format.
      See Also:
    • INT

      public static final Primitive INT
      The integer.
    • LONG

      public static final Primitive LONG
      The long.
    • FLOAT

      public static final Primitive FLOAT
      The float.
    • DOUBLE

      public static final Primitive DOUBLE
      The double.
    • STRING

      public static final Primitive STRING
      The string (not a primitive, but basically).
  • Method Details

    • values

      public static Primitive[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Primitive valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • setNoformatIntTypes

      public void setNoformatIntTypes(Primitive wantedNoformatIntPrimitive)
      Sets the primitive to use in place of integers without format. This gets set by the generator, so technically changes the constant'ness of the type. Not sure how to do it better without affecting all the call sites.
      Parameters:
      wantedNoformatIntPrimitive - the type to use for integers without format
    • typeName

      public TypeName typeName()
      Returns the type name of this type.
      Specified by:
      typeName in interface Type
      Returns:
      the type name of this type
    • wrapperTypeName

      public TypeName wrapperTypeName()
      Returns the type name of the wrapper of this type.
      Specified by:
      wrapperTypeName in interface Type
      Returns:
      the type name of the wrapper of this type
    • openapiTypeFormat

      public String openapiTypeFormat()
      Returns the OpenApi type:format of this primitive.
      Returns:
      the OpenApi type:format of this primitive
    • find

      public static @Nullable Primitive find(TypeName tn)
      Finds a primitive type matching the given type name.
      Parameters:
      tn - the type name to look for
      Returns:
      the matching primitive, or null if no matches found
    • isPrimitive

      public boolean isPrimitive(Primitive primitive)
      Description copied from interface: Type
      Return true if this type is the given primitive.
      Specified by:
      isPrimitive in interface Type
      Parameters:
      primitive - the primitive to compare against
      Returns:
      true if the same primitive, otherwise false
    • isPrimitive

      public boolean isPrimitive()
      Description copied from interface: Type
      Return true if this type is a primitive.
      Specified by:
      isPrimitive in interface Type
      Returns:
      true if this is a privimive type