Reflection Utils

src Added null check 7 months ago
.gitignore Initial commit 5 years ago
README.md Added notes 3 years ago
pom.xml Updated junit version 4 years ago
README.md

Reflection Utils

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.getParameterizedTypes(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 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 Arguments Constructor

boolean hasNoArgsContrustor = ReflectionUtils.hasNoArgsContrustor(type);
boolean hasNoArgsContrustor = ReflectionUtils.hasNoArgsContrustor(clazz);

Get Field Value

Object value = ReflectionUtils.getFieldValue(field, object);

Classes isEqual

boolean isEqual = ReflectionUtils.isEqual(clazz1, clazz2);