|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.craftforge.reflection.utils.ReflUtils
public class ReflUtils
| Constructor Summary | |
|---|---|
ReflUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
createCollection(Class<?> collectionType)
Creates a parametrized collection of the given collection type (e.g. |
|
static String |
getterName(String fieldName)
Builds the name of the get-method for the given field name. |
|
static boolean |
isActualReference(Class<?> c)
Checks if the class represents an actual reference. |
|
static boolean |
isCollection(Class<?> c)
Checks if the class is a collection (implements interface collection). |
|
static boolean |
isCollectionData(Field field)
Checks if the reference is a collection of data fields. |
|
static boolean |
isCollectionReference(Field field)
Checks if the collection is a collection of references |
|
static boolean |
isPrimitive(Class<?> c)
Checks if the class a primitive, including primitive objects (Integer, Long etc.). |
|
static boolean |
isSingleActualReference(Field field)
Checks if the field is a reference field. |
|
static boolean |
isSingleVirtualPrimitive(Field field)
Checks if the field is a data field. |
|
static boolean |
isVirtualPrimitive(Class<?> c)
Checks if the class represents a virtual primitive. |
|
static Class<?> |
primitiveToObject(Class<?> primitiveClass)
Converts a primitive class to its equivalent object class. |
|
static String |
setterName(String fieldName)
Builds the name of the set-method for the given field name. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflUtils()
| Method Detail |
|---|
public static Class<?> primitiveToObject(Class<?> primitiveClass)
Converts a primitive class to its equivalent object class. Will return the original class if it is no primitive.
Examples: int -> Integer, char -> Character, Float -> Float
primitiveClass - The primitive class
public static boolean isPrimitive(Class<?> c)
c - The class
public static boolean isVirtualPrimitive(Class<?> c)
String and Date.
c - The class
public static boolean isActualReference(Class<?> c)
c - The class
public static boolean isCollection(Class<?> c)
c - The class
public static boolean isSingleVirtualPrimitive(Field field)
field - The field
public static boolean isSingleActualReference(Field field)
field - The field
public static boolean isCollectionData(Field field)
field - The field
public static boolean isCollectionReference(Field field)
field - The field
public static String getterName(String fieldName)
fieldName - The field name
public static String setterName(String fieldName)
fieldName - The field name
public static <T> Collection<T> createCollection(Class<?> collectionType)
T - The class parametercollectionType - The collection type
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||