|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jenkov.mrpersister.util.ClassUtil
public class ClassUtil
This class contains utility methods for use on classes and methods.
Constructor Summary | |
---|---|
ClassUtil()
|
Method Summary | |
---|---|
static boolean |
areEqual(java.lang.Object object1,
java.lang.Object object2)
Returns true if the two objects are either both null, or equal. |
static java.lang.String |
classNameWithoutPackage(java.lang.Class objectClass)
Returns the name of a class with the package name cut off. |
static java.lang.String |
classNameWithoutPackage(java.lang.String fullClassName)
Returns the class name without the package name of the supplied class name. |
static int |
compare(java.lang.reflect.Method method1,
java.lang.reflect.Method method2)
|
static int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares to objects to each other, where one or both of the objects may be null. If both references are null they are considered equal and 0 is returned. If the first reference is null and the second isn't, 1 is returned If the second reference is null and the first isn't, -1 is returned If both references are not nul, and the first reference is an instance of Comparable o1.compareTo(o2) is returned.In all other cases 0 is returned, meaning the objects are considered equal, since they cannot be compared. |
static boolean |
isGetter(java.lang.reflect.Method member)
Returns true if the Method instance is a getter, meaning
if it's name starts with "get" or "is", takes no parameters, and
returns a value. |
static boolean |
isSetter(java.lang.reflect.Method member)
Returns true if the Method instance is a setter method,
meaning if the method name starts with "set" and it takes exactly
one parameter. |
static java.lang.String |
toString(java.lang.Object[] array)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassUtil()
Method Detail |
---|
public static boolean isGetter(java.lang.reflect.Method member)
Method
instance is a getter, meaning
if it's name starts with "get" or "is", takes no parameters, and
returns a value. False if not.
member
- The method to check if it is a getter method.
Method
instance is a getter. False if not.public static boolean isSetter(java.lang.reflect.Method member)
Method
instance is a setter method,
meaning if the method name starts with "set" and it takes exactly
one parameter.
member
- The Method
instance to check if is a setter method.
Method
instance is a setter. False if not.public static java.lang.String classNameWithoutPackage(java.lang.Class objectClass)
objectClass
- The class to get the class name without package name for.
public static java.lang.String classNameWithoutPackage(java.lang.String fullClassName)
fullClassName
- The fully qualified class name to get the class name of.
public static java.lang.String toString(java.lang.Object[] array)
public static int compare(java.lang.Object o1, java.lang.Object o2)
Comparable
o1.compareTo(o2) is returned.
o1
- The reference to the first object to compare.o2
- The reference to the second object to compare.
public static int compare(java.lang.reflect.Method method1, java.lang.reflect.Method method2)
public static boolean areEqual(java.lang.Object object1, java.lang.Object object2)
object1.equals(object2)
.
object1
- The first object to test for equality with the second object.object2
- The second object to test for equality with the first object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |