A representation of Java type, aiming at preserving more type information than what a Class can provide Note: using null is not recommended, #NONE should be used instead @see #asClass() : how to convert TypeInfo back to Class @see #is(Class) : how to determine whether a
| 32 | * @see #is(Class) : how to determine whether a TypeInfo represents a specific class |
| 33 | */ |
| 34 | public interface TypeInfo { |
| 35 | TypeInfo NONE = NoTypeInfo.INSTANCE; |
| 36 | |
| 37 | /** |
| 38 | * use {@link TypeInfo#isObjectExact()} to determine whether a type represents a {@link Object} |
| 39 | * class, using `typeInfo == TypeInfo.OBJECT` might cause problem with {@link VariableTypeInfo} |
| 40 | */ |
| 41 | TypeInfo OBJECT = new BasicClassTypeInfo(Object.class); |
| 42 | |
| 43 | TypeInfo OBJECT_ARRAY = new ArrayTypeInfo(OBJECT); |
| 44 | |
| 45 | TypeInfo PRIMITIVE_VOID = new PrimitiveClassTypeInfo(Void.TYPE, null); |
| 46 | TypeInfo PRIMITIVE_BOOLEAN = new PrimitiveClassTypeInfo(Boolean.TYPE, false); |
| 47 | TypeInfo PRIMITIVE_BYTE = new PrimitiveClassTypeInfo(Byte.TYPE, (byte) 0); |
| 48 | TypeInfo PRIMITIVE_SHORT = new PrimitiveClassTypeInfo(Short.TYPE, (short) 0); |
| 49 | TypeInfo PRIMITIVE_INT = new PrimitiveClassTypeInfo(Integer.TYPE, 0); |
| 50 | TypeInfo PRIMITIVE_LONG = new PrimitiveClassTypeInfo(Long.TYPE, 0L); |
| 51 | TypeInfo PRIMITIVE_FLOAT = new PrimitiveClassTypeInfo(Float.TYPE, 0F); |
| 52 | TypeInfo PRIMITIVE_DOUBLE = new PrimitiveClassTypeInfo(Double.TYPE, 0D); |
| 53 | TypeInfo PRIMITIVE_CHARACTER = new PrimitiveClassTypeInfo(Character.TYPE, (char) 0); |
| 54 | |
| 55 | TypeInfo VOID = new BasicClassTypeInfo(Void.class); |
| 56 | TypeInfo BOOLEAN = new BasicClassTypeInfo(Boolean.class); |
| 57 | TypeInfo BYTE = new BasicClassTypeInfo(Byte.class); |
| 58 | TypeInfo SHORT = new BasicClassTypeInfo(Short.class); |
| 59 | TypeInfo INT = new BasicClassTypeInfo(Integer.class); |
| 60 | TypeInfo LONG = new BasicClassTypeInfo(Long.class); |
| 61 | TypeInfo FLOAT = new BasicClassTypeInfo(Float.class); |
| 62 | TypeInfo DOUBLE = new BasicClassTypeInfo(Double.class); |
| 63 | TypeInfo CHARACTER = new BasicClassTypeInfo(Character.class); |
| 64 | |
| 65 | TypeInfo NUMBER = new BasicClassTypeInfo(Number.class); |
| 66 | TypeInfo STRING = new BasicClassTypeInfo(String.class); |
| 67 | TypeInfo STRING_ARRAY = new ArrayTypeInfo(STRING); |
| 68 | TypeInfo RAW_CLASS = new BasicClassTypeInfo(Class.class); |
| 69 | TypeInfo DATE = new BasicClassTypeInfo(Date.class); |
| 70 | |
| 71 | TypeInfo RUNNABLE = new InterfaceTypeInfo(Runnable.class, ByteAsBool.TRUE); |
| 72 | TypeInfo RAW_CONSUMER = new InterfaceTypeInfo(Consumer.class, ByteAsBool.TRUE); |
| 73 | TypeInfo RAW_SUPPLIER = new InterfaceTypeInfo(Supplier.class, ByteAsBool.TRUE); |
| 74 | TypeInfo RAW_FUNCTION = new InterfaceTypeInfo(Function.class, ByteAsBool.TRUE); |
| 75 | TypeInfo RAW_PREDICATE = new InterfaceTypeInfo(Predicate.class, ByteAsBool.TRUE); |
| 76 | |
| 77 | TypeInfo RAW_LIST = new InterfaceTypeInfo(List.class, ByteAsBool.FALSE); |
| 78 | TypeInfo RAW_SET = new InterfaceTypeInfo(Set.class, ByteAsBool.FALSE); |
| 79 | TypeInfo RAW_MAP = new InterfaceTypeInfo(Map.class, ByteAsBool.FALSE); |
| 80 | TypeInfo RAW_OPTIONAL = new BasicClassTypeInfo(Optional.class); |
| 81 | TypeInfo RAW_ENUM_SET = new BasicClassTypeInfo(EnumSet.class); |
| 82 | TypeInfo BIG_INT = new BasicClassTypeInfo(BigInteger.class); |
| 83 | |
| 84 | /** |
| 85 | * Get the {@link Class} object represented by this {@link TypeInfo}. For a {@link |
| 86 | * java.lang.reflect.Type} object, the TypeInfo object created from the Type object should |
| 87 | * return the exact same class as the one after Java erased its generic type info |
| 88 | */ |
| 89 | Class<?> asClass(); |
| 90 | |
| 91 | /** |
no outgoing calls
no test coverage detected