Reflection Utils
| src | 6 months ago | ||
| .gitignore | 5 years ago | ||
| README.md | 6 months ago | ||
| pom.xml | 6 months ago | ||
A collection of useful reflection utilities.
Get Owner Type
Type owner = ReflectionUtils.getOwnerType(type);
Is Parameterized
boolean isParameterized = ReflectionUtils.isParameterized(type);
Get Parameterized Type
Type parameterizedType = ReflectionUtils.getParameterizedType(type);
Get Parameterized Types
Type[] parameterizedTypes = ReflectionUtils.getParameterizedTypes(type);
Get Array Component Type
Type componentType = ReflectionUtils.getArrayComponentType(type);
Get Object Fields
List<Field> fields = ReflectionUtils.getObjectFields(clazz);
Is Primitive
boolean isPrimitive = ReflectionUtils.isPrimitive(type); boolean isPrimitive = ReflectionUtils.isPrimitive(clazz);
Is Number
boolean isNumber = ReflectionUtils.isNumber(t); boolean isNumber = ReflectionUtils.isNumber(type); boolean isNumber = ReflectionUtils.isNumber(clazz);
Is Integer
boolean isInteger = ReflectionUtils.isInteger(t); boolean isInteger = ReflectionUtils.isInteger(type); boolean isInteger = ReflectionUtils.isInteger(clazz);
Is Double
boolean isDouble = ReflectionUtils.isDouble(t); boolean isDouble = ReflectionUtils.isDouble(type); boolean isDouble = ReflectionUtils.isDouble(clazz);
Is Short
boolean isShort = ReflectionUtils.isShort(t); boolean isShort = ReflectionUtils.isShort(type); boolean isShort = ReflectionUtils.isShort(clazz);
Is Long
boolean isLong = ReflectionUtils.isLong(t); boolean isLong = ReflectionUtils.isLong(type); boolean isLong = ReflectionUtils.isLong(clazz);
Is Float
boolean isFloat = ReflectionUtils.isFloat(t); boolean isFloat = ReflectionUtils.isFloat(type); boolean isFloat = ReflectionUtils.isFloat(clazz);
Is Big Decimal
boolean isBigDecimal = ReflectionUtils.isBigDecimal(t); boolean isBigDecimal = ReflectionUtils.isBigDecimal(type); boolean isBigDecimal = ReflectionUtils.isBigDecimal(clazz);
Is Byte
boolean isByte = ReflectionUtils.isByte(t); boolean isByte = ReflectionUtils.isByte(type); boolean isByte = ReflectionUtils.isByte(clazz);
Is Boolean
boolean isBoolean = ReflectionUtils.isBoolean(t); boolean isBoolean = ReflectionUtils.isBoolean(type); boolean isBoolean = ReflectionUtils.isBoolean(clazz);
Is String
boolean isString = ReflectionUtils.isString(t); boolean isString = ReflectionUtils.isString(type); boolean isString = ReflectionUtils.isString(clazz);
Is Enum
boolean isEnum = ReflectionUtils.isEnum(t); boolean isEnum = ReflectionUtils.isEnum(type); boolean isEnum = ReflectionUtils.isEnum(clazz);
Is Boxed
boolean isBoxed = ReflectionUtils.isBoxed(type); boolean isBoxed = ReflectionUtils.isBoxed(clazz);
Is List
boolean isList = ReflectionUtils.isList(t); boolean isList = ReflectionUtils.isList(type); boolean isList = ReflectionUtils.isList(clazz);
Is Map
boolean isMap = ReflectionUtils.isMap(t); boolean isMap = ReflectionUtils.isMap(type); boolean isMap = ReflectionUtils.isMap(clazz);
Is Array
boolean isArray = ReflectionUtils.isArray(t); boolean isArray = ReflectionUtils.isArray(type); boolean isArray = ReflectionUtils.isArray(clazz);
Is Set
boolean isSet = ReflectionUtils.isSet(t); boolean isSet = ReflectionUtils.isSet(type); boolean isSet = ReflectionUtils.isSet(clazz);
Is Collection
boolean isCollection = ReflectionUtils.isCollection(t); boolean isCollection = ReflectionUtils.isCollection(type); boolean isCollection = ReflectionUtils.isCollection(clazz);
Is Iterable
boolean isIterable = ReflectionUtils.isIterable(t); boolean isIterable = ReflectionUtils.isIterable(type); boolean isIterable = ReflectionUtils.isIterable(clazz);
Has No Args Constructor
boolean hasNoArgsConstructor = ReflectionUtils.hasNoArgsConstructor(type); boolean hasNoArgsConstructor = ReflectionUtils.hasNoArgsConstructor(clazz);
Get Field Value
Object value = ReflectionUtils.getFieldValue(field, object);