Package one.microstream.typing
Class XTypes
- java.lang.Object
-
- one.microstream.typing.XTypes
-
public final class XTypes extends Object
Collection of generic util logic missing or too complicated in JDK API.
-
-
Constructor Summary
Constructors Constructor Description XTypes()
-
Method Summary
Modifier and Type Method Description static Byte
asByte(Number value)
static Double
asDouble(Number value)
static Float
asFloat(Number value)
static Integer
asInteger(Number value)
static Long
asLong(Number value)
static Short
asShort(Number value)
static TypeMapping<Float>
createDefaultTypeSimilarity()
static Class<?>
directByteBufferClass()
static ByteBuffer
guaranteeDirectByteBuffer(ByteBuffer directBuffer)
static boolean
isBoolean(Object o)
static boolean
isBooleanType(Class<?> c)
static boolean
isByteType(Class<?> c)
static boolean
isCharacterType(Class<?> c)
static boolean
isCharSequenceType(Class<?> c)
static boolean
isDecimal(Object o)
static boolean
isDecimalType(Class<?> c)
static boolean
isDirectByteBuffer(ByteBuffer byteBuffer)
static boolean
isDoubleType(Class<?> c)
static boolean
isFloatType(Class<?> c)
static boolean
isIntegerType(Class<?> c)
static boolean
isLiteral(Object o)
static boolean
isLiteralType(Class<?> c)
static boolean
isLongType(Class<?> c)
static boolean
isNaturalNumber(Object o)
static boolean
isNaturalNumberType(Class<?> c)
static boolean
isNumber(Object o)
static boolean
isNumberType(Class<?> c)
static boolean
isPrimitiveWrapper(Object o)
static boolean
isShortType(Class<?> c)
static boolean
isStringType(Class<?> c)
static boolean
isValueType(Class<?> c)
static boolean
isValueType(Object o)
Checks if the type of the passed instance is an immutable special value type of the java language.static boolean
to_boolean(byte value)
static byte
to_byte(boolean value)
static int
to_int(boolean value)
static int
to_int(double value)
static int
to_int(float value)
static int
to_int(long value)
static int
to_int(Number value)
-
-
-
Method Detail
-
directByteBufferClass
public static final Class<?> directByteBufferClass()
-
isDirectByteBuffer
public static final boolean isDirectByteBuffer(ByteBuffer byteBuffer)
-
guaranteeDirectByteBuffer
public static final ByteBuffer guaranteeDirectByteBuffer(ByteBuffer directBuffer)
-
isBooleanType
public static boolean isBooleanType(Class<?> c)
-
isByteType
public static boolean isByteType(Class<?> c)
-
isShortType
public static boolean isShortType(Class<?> c)
-
isIntegerType
public static boolean isIntegerType(Class<?> c)
-
isLongType
public static boolean isLongType(Class<?> c)
-
isFloatType
public static boolean isFloatType(Class<?> c)
-
isDoubleType
public static boolean isDoubleType(Class<?> c)
-
isCharacterType
public static boolean isCharacterType(Class<?> c)
-
isStringType
public static boolean isStringType(Class<?> c)
-
isCharSequenceType
public static boolean isCharSequenceType(Class<?> c)
-
isNaturalNumberType
public static boolean isNaturalNumberType(Class<?> c)
-
isDecimalType
public static boolean isDecimalType(Class<?> c)
-
isNumberType
public static boolean isNumberType(Class<?> c)
-
isLiteralType
public static boolean isLiteralType(Class<?> c)
-
isValueType
public static boolean isValueType(Class<?> c)
-
isNaturalNumber
public static boolean isNaturalNumber(Object o)
-
isNumber
public static boolean isNumber(Object o)
-
isDecimal
public static boolean isDecimal(Object o)
-
isLiteral
public static boolean isLiteral(Object o)
-
isBoolean
public static boolean isBoolean(Object o)
-
isValueType
public static boolean isValueType(Object o)
Checks if the type of the passed instance is an immutable special value type of the java language. This includes all primitive wrappers andString
.- Parameters:
o
- the instance to be checked- Returns:
true
if the type of the passed instance is an immutable special value type.
-
isPrimitiveWrapper
public static boolean isPrimitiveWrapper(Object o)
-
to_byte
public static final byte to_byte(boolean value)
-
to_boolean
public static final boolean to_boolean(byte value)
-
to_int
public static final int to_int(boolean value)
-
to_int
public static final int to_int(long value) throws NumberRangeException
- Throws:
NumberRangeException
-
to_int
public static final int to_int(float value) throws NumberRangeException
- Throws:
NumberRangeException
-
to_int
public static final int to_int(double value) throws NumberRangeException
- Throws:
NumberRangeException
-
to_int
public static final int to_int(Number value) throws NumberRangeException, NullPointerException
-
createDefaultTypeSimilarity
public static final TypeMapping<Float> createDefaultTypeSimilarity()
-
-