Class JxnParameterCheck
- java.lang.Object
-
- JxnParameterCheck
-
public class JxnParameterCheck extends Object
Collection of static methods to test ...
... the result type of an expression:whatIs
(expression)
calls the matching of overloaded methods.
... if an argumentvalue
of given type matches a method parameter of typeT
:testT(value)
.
... the transfer of an argumentvalue
to a method parameter of typeT
:asT(value)
(with possible implicit cast on method invocation).
Examples of use in JXN:#import static JxnParameterCheck i4 = 12345 = 12345 (int) whatIs i4 = int:12345 (java.lang.String) testDouble i4 = double:12345.0 (java.lang.String) testLong i4 = long:12345 (java.lang.String) testInt i4 = int:12345 (java.lang.String) testShort i4 ! int:12345 fits into short = short:12345 (java.lang.String) testByte i4 ! int:12345 does not fit into byte ? ^ ? invokeMethod: identifier testByte( int ) undefined, wrong number of parameters or not public ! but: i4 = 123 = 123 (int) testByte i4 ! int:123 fits into byte = byte:123 (java.lang.String) ! and: testInt 1.0 ! double:1.0 is not implicitly cast to int ? ^ ? invokeMethod: identifier testInt( double ) undefined, wrong number of parameters or not public
-
-
Field Summary
Fields Modifier and Type Field Description static int
verboseLevel
SeesetVerboseLevel(int)
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
asBoolean(boolean value)
Returns the argumentvalue
asboolean
.static byte
asByte(byte value)
Returns the argumentvalue
asbyte
.static char
asChar(char value)
Returns the argumentvalue
aschar
.static double
asDouble(double value)
Returns the argumentvalue
asdouble
.static float
asFloat(float value)
Returns the argumentvalue
asfloat
.static int
asInt(int value)
Returns the argumentvalue
asint
.static long
asLong(long value)
Returns the argumentvalue
aslong
.static Object
asObject(Object o)
static short
asShort(short value)
Returns the argumentvalue
asshort
.static String
asString(String value)
static int
setVerboseLevel(int newVerboseLevel)
SetsverboseLevel
for the internal call ofKmgStaticUtilities.toString(Object obj, int verboseLevel)
fromwhatIs(Object)
,testObject(Object)
,testArrayObject(Object)
andtestObjectArray(Object[])
.static String
testArrayObject(Object ao)
Tests if the argumentao
matches an array object parameter.static String
testBoolean(boolean value)
Tests if the argumentvalue
matches aboolean
parameter.static String
testBoolean(boolean x, boolean y)
Tests if the argumentsx
andy
match the given signature.static String
testBooleanArray(boolean[] arr)
Tests if the argumentarr
matches aboolean[]
parameter.static String
testBooleanWrapper(Boolean value)
static String
testByte(byte value)
Tests if the argumentvalue
matches abyte
parameter.static String
testByte(byte x, byte y)
Tests if the argumentsx
andy
match the given signature.static String
testByteArray(byte[] arr)
Tests if the argumentarr
matches abyte[]
parameter.static String
testByteWrapper(Byte value)
static String
testChar(char value)
Tests if the argumentvalue
matches achar
parameter.static String
testChar(char x, char y)
Tests if the argumentsx
andy
match the given signature.static String
testCharArray(char[] arr)
Tests if the argumentarr
matches achar[]
parameter.static String
testCharWrapper(Character value)
static String
testDouble(double value)
Tests if the argumentvalue
matches adouble
parameter.static String
testDouble(double x, double y)
Tests if the argumentsx
andy
match the given signature.static String
testDoubleArray(double[] arr)
Tests if the argumentarr
matches adouble[]
parameter.static String
testDoubleWrapper(Double value)
static String
testFloat(float value)
Tests if the argumentvalue
matches afloat
parameter.static String
testFloat(float x, float y)
Tests if the argumentsx
andy
match the given signature.static String
testFloatArray(float[] arr)
Tests if the argumentarr
matches afloat[]
parameter.static String
testFloatWrapper(Float value)
static String
testInstance(Object o)
Tests if the argumentvalue
matches an Object parameter.static String
testInstance(Object[] oa)
Tests if the argumentvalue
matches an Object [] parameter.static String
testInstance(String value)
Tests if the argumentvalue
matches a String parameter.static String
testInstance(String[] arr)
Tests if the argumentvalue
matches a String [] parameter.static String
testInt(int value)
Tests if the argumentvalue
matches anint
parameter.static String
testInt(int x, int y)
Tests if the argumentsx
andy
match the given signature.static String
testIntArray(int[] arr)
Tests if the argumentarr
matches aint[]
parameter.static String
testIntWrapper(Integer value)
static String
testLong(long value)
Tests if the argumentvalue
matches along
parameter.static String
testLong(long x, long y)
Tests if the argumentsx
andy
match the given signature.static String
testLongArray(long[] arr)
Tests if the argumentarr
matches along[]
parameter.static String
testLongWrapper(Long value)
static String
testNumber(Number value)
static String
testNumerical(double value)
Tests if the argumentvalue
matches a numerical parameter (double
orlong
).static String
testNumerical(long value)
Tests if the argumentvalue
matches a numerical parameter (double
orlong
).static String
testObject(Object o)
static String
testObject(Object x, Object y)
Tests if the argumentsx
andy
match the given signature.static String
testObjectArray(Object[] oa)
static String
testPrimitive(boolean value)
Tests if the argumentvalue
matches a java primitive parameter.static String
testPrimitive(byte value)
Tests if the argumentvalue
matches a java primitive parameter.static String
testPrimitive(char value)
Tests if the argumentvalue
matches a java primitive parameter.static String
testPrimitive(double value)
Tests if the argumentvalue
matches a java primitive parameter.static String
testPrimitive(float value)
Tests if the argumentvalue
matches a java primitive parameter.static String
testPrimitive(int value)
Tests if the argumentvalue
matches a java primitive parameter.static String
testPrimitive(long value)
Tests if the argumentvalue
matches a java primitive parameter.static String
testPrimitive(short value)
Tests if the argumentvalue
matches a java primitive parameter.static String
testShort(short value)
Tests if the argumentvalue
matches ashort
parameter.static String
testShort(short x, short y)
Tests if the argumentsx
andy
match the given signature.static String
testShortArray(short[] arr)
Tests if the argumentarr
matches ashort[]
parameter.static String
testShortWrapper(Short value)
static String
testString(String value)
static String
testString(String x, String y)
Tests if the argumentsx
andy
match the given signature.static String
testStringArray(String[] arr)
static String
testWrapper(Boolean value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.static String
testWrapper(Byte value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.static String
testWrapper(Character value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.static String
testWrapper(Double value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.static String
testWrapper(Float value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.static String
testWrapper(Integer value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.static String
testWrapper(Long value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.static String
testWrapper(Short value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.static String
testXY(boolean x, boolean y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(byte x, byte y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(char x, char y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(double x, double y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(float x, float y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(int x, int y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(long x, long y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(short x, short y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(Object x, Object y)
Tests which signature is called for the given argumentsx
andy
.static String
testXY(String x, String y)
Tests which signature is called for the given argumentsx
andy
.static String
whatIs(boolean value)
Returns the type of the argumentvalue
.static String
whatIs(byte value)
Returns the type of the argumentvalue
.static String
whatIs(char value)
Returns the type of the argumentvalue
.static String
whatIs(double value)
Returns the type of the argumentvalue
.static String
whatIs(float value)
Returns the type of the argumentvalue
.static String
whatIs(int value)
Returns the type of the argumentvalue
.static String
whatIs(long value)
Returns the type of the argumentvalue
.static String
whatIs(short value)
Returns the type of the argumentvalue
.static String
whatIs(Boolean value)
Returns the type of the argumentvalue
.static String
whatIs(Byte value)
Returns the type of the argumentvalue
.static String
whatIs(Character value)
Returns the type of the argumentvalue
.static String
whatIs(Double value)
Returns the type of the argumentvalue
.static String
whatIs(Float value)
Returns the type of the argumentvalue
.static String
whatIs(Integer value)
Returns the type of the argumentvalue
.static String
whatIs(Long value)
Returns the type of the argumentvalue
.static String
whatIs(Object obj)
Returns the type of the argumentobj
.static String
whatIs(Short value)
Returns the type of the argumentvalue
.
-
-
-
Field Detail
-
verboseLevel
public static int verboseLevel
SeesetVerboseLevel(int)
.
-
-
Method Detail
-
setVerboseLevel
public static int setVerboseLevel(int newVerboseLevel)
SetsverboseLevel
for the internal call ofKmgStaticUtilities.toString(Object obj, int verboseLevel)
fromwhatIs(Object)
,testObject(Object)
,testArrayObject(Object)
andtestObjectArray(Object[])
.- Returns:
- old value of
verboseLevel
-
whatIs
public static String whatIs(double value)
Returns the type of the argumentvalue
.
-
whatIs
public static String whatIs(float value)
Returns the type of the argumentvalue
.
-
whatIs
public static String whatIs(long value)
Returns the type of the argumentvalue
.
-
whatIs
public static String whatIs(int value)
Returns the type of the argumentvalue
.
-
whatIs
public static String whatIs(short value)
Returns the type of the argumentvalue
.
-
whatIs
public static String whatIs(byte value)
Returns the type of the argumentvalue
.
-
whatIs
public static String whatIs(char value)
Returns the type of the argumentvalue
.
-
whatIs
public static String whatIs(boolean value)
Returns the type of the argumentvalue
.
-
testInstance
public static String testInstance(String value)
Tests if the argumentvalue
matches a String parameter.
-
testInstance
public static String testInstance(String[] arr)
Tests if the argumentvalue
matches a String [] parameter.
-
testInstance
public static String testInstance(Object o)
Tests if the argumentvalue
matches an Object parameter.
-
testInstance
public static String testInstance(Object[] oa)
Tests if the argumentvalue
matches an Object [] parameter.
-
testNumerical
public static String testNumerical(double value)
Tests if the argumentvalue
matches a numerical parameter (double
orlong
).
-
testNumerical
public static String testNumerical(long value)
Tests if the argumentvalue
matches a numerical parameter (double
orlong
).
-
testPrimitive
public static String testPrimitive(double value)
Tests if the argumentvalue
matches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(float value)
Tests if the argumentvalue
matches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(long value)
Tests if the argumentvalue
matches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(int value)
Tests if the argumentvalue
matches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(short value)
Tests if the argumentvalue
matches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(byte value)
Tests if the argumentvalue
matches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(char value)
Tests if the argumentvalue
matches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(boolean value)
Tests if the argumentvalue
matches a java primitive parameter.
-
testWrapper
public static String testWrapper(Double value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Float value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Long value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Integer value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Short value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Byte value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Character value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Boolean value)
Tests if the argumentvalue
matches a java primitive wrapper parameter.
-
testDouble
public static String testDouble(double value)
Tests if the argumentvalue
matches adouble
parameter.
-
testFloat
public static String testFloat(float value)
Tests if the argumentvalue
matches afloat
parameter.
-
testLong
public static String testLong(long value)
Tests if the argumentvalue
matches along
parameter.
-
testInt
public static String testInt(int value)
Tests if the argumentvalue
matches anint
parameter.
-
testShort
public static String testShort(short value)
Tests if the argumentvalue
matches ashort
parameter.
-
testByte
public static String testByte(byte value)
Tests if the argumentvalue
matches abyte
parameter.
-
testChar
public static String testChar(char value)
Tests if the argumentvalue
matches achar
parameter.
-
testBoolean
public static String testBoolean(boolean value)
Tests if the argumentvalue
matches aboolean
parameter.
-
testArrayObject
public static String testArrayObject(Object ao)
Tests if the argumentao
matches an array object parameter.
-
testDoubleArray
public static String testDoubleArray(double[] arr)
Tests if the argumentarr
matches adouble[]
parameter.
-
testFloatArray
public static String testFloatArray(float[] arr)
Tests if the argumentarr
matches afloat[]
parameter.
-
testLongArray
public static String testLongArray(long[] arr)
Tests if the argumentarr
matches along[]
parameter.
-
testIntArray
public static String testIntArray(int[] arr)
Tests if the argumentarr
matches aint[]
parameter.
-
testShortArray
public static String testShortArray(short[] arr)
Tests if the argumentarr
matches ashort[]
parameter.
-
testByteArray
public static String testByteArray(byte[] arr)
Tests if the argumentarr
matches abyte[]
parameter.
-
testCharArray
public static String testCharArray(char[] arr)
Tests if the argumentarr
matches achar[]
parameter.
-
testBooleanArray
public static String testBooleanArray(boolean[] arr)
Tests if the argumentarr
matches aboolean[]
parameter.
-
testDouble
public static String testDouble(double x, double y)
Tests if the argumentsx
andy
match the given signature.
-
testFloat
public static String testFloat(float x, float y)
Tests if the argumentsx
andy
match the given signature.
-
testLong
public static String testLong(long x, long y)
Tests if the argumentsx
andy
match the given signature.
-
testInt
public static String testInt(int x, int y)
Tests if the argumentsx
andy
match the given signature.
-
testShort
public static String testShort(short x, short y)
Tests if the argumentsx
andy
match the given signature.
-
testByte
public static String testByte(byte x, byte y)
Tests if the argumentsx
andy
match the given signature.
-
testChar
public static String testChar(char x, char y)
Tests if the argumentsx
andy
match the given signature.
-
testBoolean
public static String testBoolean(boolean x, boolean y)
Tests if the argumentsx
andy
match the given signature.
-
testString
public static String testString(String x, String y)
Tests if the argumentsx
andy
match the given signature.
-
testObject
public static String testObject(Object x, Object y)
Tests if the argumentsx
andy
match the given signature.
-
testXY
public static String testXY(double x, double y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(float x, float y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(long x, long y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(int x, int y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(short x, short y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(byte x, byte y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(char x, char y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(boolean x, boolean y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(String x, String y)
Tests which signature is called for the given argumentsx
andy
.
-
testXY
public static String testXY(Object x, Object y)
Tests which signature is called for the given argumentsx
andy
.
-
asDouble
public static double asDouble(double value)
Returns the argumentvalue
asdouble
.
-
asFloat
public static float asFloat(float value)
Returns the argumentvalue
asfloat
.
-
asLong
public static long asLong(long value)
Returns the argumentvalue
aslong
.
-
asInt
public static int asInt(int value)
Returns the argumentvalue
asint
.
-
asShort
public static short asShort(short value)
Returns the argumentvalue
asshort
.
-
asByte
public static byte asByte(byte value)
Returns the argumentvalue
asbyte
.
-
asChar
public static char asChar(char value)
Returns the argumentvalue
aschar
.
-
asBoolean
public static boolean asBoolean(boolean value)
Returns the argumentvalue
asboolean
.
-
-