Package org.apache.juneau.internal
Class ClassUtils
java.lang.Object
org.apache.juneau.internal.ClassUtils
Class-related utility methods.
See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Returns the fully-qualified class name for the specified object.static Class<?>[]
getClasses
(Object... args) Returns the class types for the specified arguments.static Object[]
getMatchingArgs
(Class<?>[] paramTypes, Object... args) Matches arguments to a list of parameter types.static boolean
static boolean
static boolean
setAccessible
(Constructor<?> x) Attempts to callx.setAccessible(
and quietly ignores security exceptions.true )static boolean
Attempts to callx.setAccessible(
and quietly ignores security exceptions.true )static boolean
Attempts to callx.setAccessible(
and quietly ignores security exceptions.true )static String
simpleClassName
(Object value) Returns the simple class name for the specified object.static Class<?>
Returns the specified type as aClass .
-
Field Details
-
NOT_VOID
Predicate check to filter out void classes.
-
-
Constructor Details
-
ClassUtils
public ClassUtils()
-
-
Method Details
-
getClasses
Returns the class types for the specified arguments.- Parameters:
args
- The objects we're getting the classes of.- Returns:
- The classes of the arguments.
-
getMatchingArgs
Matches arguments to a list of parameter types.Extra parameters are ignored.
Missing parameters are left null.- Parameters:
paramTypes
- The parameter types.args
- The arguments to match to the parameter types.- Returns:
- An array of parameters.
-
setAccessible
Attempts to callx.setAccessible(
and quietly ignores security exceptions.true )- Parameters:
x
- The constructor.- Returns:
true if call was successful.
-
setAccessible
Attempts to callx.setAccessible(
and quietly ignores security exceptions.true )- Parameters:
x
- The method.- Returns:
true if call was successful.
-
setAccessible
Attempts to callx.setAccessible(
and quietly ignores security exceptions.true )- Parameters:
x
- The field.- Returns:
true if call was successful.
-
toClass
Returns the specified type as aClass .If it's already a
Class , it just does a cast.
If it's aParameterizedType , it returns the raw type.- Parameters:
t
- The type to convert.- Returns:
- The type converted to a
Class , ornull if it could not be converted.
-
className
Returns the fully-qualified class name for the specified object.- Parameters:
value
- The object to get the class name for.- Returns:
- The name of the class or
null if the value was null.
-
simpleClassName
Returns the simple class name for the specified object.- Parameters:
value
- The object to get the class name for.- Returns:
- The name of the class or
null if the value was null.
-
isVoid
- Parameters:
c
- The class to check.- Returns:
true if the specific class isnull or orvoid .class Void
or has the simple name"Void .
-
isNotVoid
- Parameters:
c
- The class to check.- Returns:
false if the specific class isnull or orvoid .class Void
or has the simple name"Void .
-