Package yakworks.commons.lang
Class AssignUtils
- java.lang.Object
-
- yakworks.commons.lang.AssignUtils
-
public class AssignUtils extends java.lang.ObjectProvides methods to help with reflective operations- See Also:
ReflectionUtils
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<java.lang.Class<?>,java.lang.Class<?>>PRIMITIVE_TYPE_COMPATIBLE_CLASSES
-
Constructor Summary
Constructors Constructor Description AssignUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisAssignableFrom(java.lang.Class<?> leftType, java.lang.Class<?> rightType)Tests whether or not the left hand type is compatible with the right hand type in Groovy terms, i.e.static booleanisGetter(java.lang.String name, java.lang.Class<?>[] args)Returns true if the name of the method specified and the number of arguments make it a javabean propertystatic booleanisSetter(java.lang.String name, java.lang.Class[] args)
-
-
-
Method Detail
-
isAssignableFrom
public static boolean isAssignableFrom(java.lang.Class<?> leftType, java.lang.Class<?> rightType)Tests whether or not the left hand type is compatible with the right hand type in Groovy terms, i.e. can the left type be assigned a value of the right hand type in Groovy.
This handles Java primitive type equivalence and uses isAssignableFrom for all other types, with a bit of magic for native types and polymorphism i.e. Number assigned an int. If either parameter is null an exception is thrown
- Parameters:
leftType- The type of the left hand part of a notional assignmentrightType- The type of the right hand part of a notional assignment- Returns:
- True if values of the right hand type can be assigned in Groovy to variables of the left hand type.
-
isGetter
public static boolean isGetter(java.lang.String name, java.lang.Class<?>[] args)Returns true if the name of the method specified and the number of arguments make it a javabean property- Parameters:
name- True if its a Javabean propertyargs- The arguments- Returns:
- true if it is a javabean property method
-
isSetter
public static boolean isSetter(java.lang.String name, java.lang.Class[] args)
-
-