Class FloatCachedClass
java.lang.Object
org.codehaus.groovy.reflection.CachedClass
org.codehaus.groovy.reflection.stdclasses.NumberCachedClass
org.codehaus.groovy.reflection.stdclasses.FloatCachedClass
-
Nested Class Summary
Nested classes/interfaces inherited from class org.codehaus.groovy.reflection.CachedClass
CachedClass.CachedMethodComparatorByName, CachedClass.CachedMethodComparatorWithString -
Field Summary
Fields inherited from class org.codehaus.groovy.reflection.CachedClass
classInfo, EMPTY_ARRAY, isArray, isInterface, isNumber, isPrimitive, modifiers, mopMethods -
Constructor Summary
ConstructorsConstructorDescriptionFloatCachedClass(Class klazz, ClassInfo classInfo, boolean allowNull) Constructs a cached class representation for the given float class. -
Method Summary
Modifier and TypeMethodDescriptioncoerceArgument(Object argument) Coerces the given numeric argument to a float value.booleanisAssignableFrom(Class classToTransformFrom) Determines if the given class can be transformed to float/Float.booleanisDirectlyAssignable(Object argument) Checks if the given argument is directly assignable without type conversion.Methods inherited from class org.codehaus.groovy.reflection.CachedClass
addNewMopMethods, getCachedClass, getCachedSuperClass, getCallSiteLoader, getConstructors, getDeclaredInterfaces, getFields, getHierarchy, getInterfaces, getMethods, getModifiers, getName, getNewMetaMethods, getSuperClassDistance, getTheClass, getTypeDescription, hashCode, isInterface, isPrimitive, isVoid, searchMethods, setNewMopMethods, toString
-
Constructor Details
-
FloatCachedClass
Constructs a cached class representation for the given float class.
-
-
Method Details
-
coerceArgument
Coerces the given numeric argument to a float value. Validates thatBigDecimalconversions do not overflow to infinity.- Overrides:
coerceArgumentin classNumberCachedClass- Parameters:
argument- the argument to coerce- Returns:
- the argument as a
float, or the original argument if not a number - Throws:
IllegalArgumentException- if aBigDecimalconversion results in infinity
-
isDirectlyAssignable
Checks if the given argument is directly assignable without type conversion.- Overrides:
isDirectlyAssignablein classCachedClass- Parameters:
argument- the argument to check- Returns:
trueif the argument is aFloatinstance, ornullis allowed,falseotherwise
-
isAssignableFrom
Determines if the given class can be transformed to float/Float. Accepts integral and big numeric types.- Overrides:
isAssignableFromin classNumberCachedClass- Parameters:
classToTransformFrom- the source class to check- Returns:
trueif the class can be transformed to float,falseotherwise
-