Package dk.mada.jaxrs.model.types
Enum Class Primitive
- All Implemented Interfaces:
Type
,Serializable
,Comparable<Primitive>
,Constable
Primitive types of the java language (plus String).
There is https://swagger.io/specification/#data-types and there is https://spec.openapis.org/registry/format/ But
Quarkus/smallrye-open-api implements formatted numbers as integers.
https://github.com/smallrye/smallrye-open-api/pull/2128
So three combatants...
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe boolean.The byte via (legacy) https://swagger.io/specification/#data-types.The byte via smallrye #2128.The byte via https://spec.openapis.org/registry/format/.The double.The float.The integer.The long.An integer of unknown format.The short - not mapped in legacy https://swagger.io/specification/#data-types.The short via smallrye #2128.The byte via https://spec.openapis.org/registry/format/.The string (not a primitive, but basically). -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Primitive
Finds a primitive type matching the given type name.Returns the resolved primitive for this instance.boolean
isNumber()
Returns true if this primitive is a OpenApi number.boolean
Returns true if this type is a Java primitive.boolean
isPrimitive
(Primitive primitive) Return true if this type is the given primitive.Returns the OpenApi type:format of this primitive.void
setNoformatIntTypes
(Primitive wantedNoformatIntPrimitive) Sets the primitive to use in place of integers without format.typeName()
Returns the type name of this type.static Primitive
Returns the enum constant of this class with the specified name.static Primitive[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Returns the type name of the wrapper of this type.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from interface dk.mada.jaxrs.model.types.Type
isBigDecimal, isContainer, isDate, isDateTime, isDto, isEnum, isPlainObject, isTime, isUUID, isValidation, isVoid, neededImports
-
Enum Constant Details
-
BOOLEAN
The boolean. -
NOFORMAT_INT
An integer of unknown format. Generator decides how to render this.- See Also:
-
BYTE
The byte via (legacy) https://swagger.io/specification/#data-types. -
BYTE_INT
The byte via smallrye #2128. -
BYTE_NUMBER
The byte via https://spec.openapis.org/registry/format/. -
SHORT
The short - not mapped in legacy https://swagger.io/specification/#data-types. -
SHORT_INT
The short via smallrye #2128. -
SHORT_NUMBER
The byte via https://spec.openapis.org/registry/format/. -
INT
The integer. -
LONG
The long. -
FLOAT
The float. -
DOUBLE
The double. -
STRING
The string (not a primitive, but basically).
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
setNoformatIntTypes
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
-
getResolvedPrimitive
Returns the resolved primitive for this instance. This will replace noformat-int with the actual type selected by the user.- Returns:
- the resolved primitive for this instance
-
typeName
Returns the type name of this type. -
wrapperTypeName
Returns the type name of the wrapper of this type.- Specified by:
wrapperTypeName
in interfaceType
- Returns:
- the type name of the wrapper of this type
-
openapiTypeFormat
Returns the OpenApi type:format of this primitive.- Returns:
- the OpenApi type:format of this primitive
-
find
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
Description copied from interface:Type
Return true if this type is the given primitive.- Specified by:
isPrimitive
in interfaceType
- Parameters:
primitive
- the primitive to compare against- Returns:
- true if the same primitive, otherwise false
-
isPrimitive
public boolean isPrimitive()Description copied from interface:Type
Returns true if this type is a Java primitive.- Specified by:
isPrimitive
in interfaceType
- Returns:
- true if this type is a Java primitive
-
isNumber
public boolean isNumber()Returns true if this primitive is a OpenApi number. Note that there is an overlap with integer.- Returns:
- true if this primitive is a OpenApi number
-