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 argumentvalueof given type matches a method parameter of typeT:testT(value).
... the transfer of an argumentvalueto 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 intverboseLevelSeesetVerboseLevel(int).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanasBoolean(boolean value)Returns the argumentvalueasboolean.static byteasByte(byte value)Returns the argumentvalueasbyte.static charasChar(char value)Returns the argumentvalueaschar.static doubleasDouble(double value)Returns the argumentvalueasdouble.static floatasFloat(float value)Returns the argumentvalueasfloat.static intasInt(int value)Returns the argumentvalueasint.static longasLong(long value)Returns the argumentvalueaslong.static ObjectasObject(Object o)static shortasShort(short value)Returns the argumentvalueasshort.static StringasString(String value)static intsetVerboseLevel(int newVerboseLevel)SetsverboseLevelfor the internal call ofKmgStaticUtilities.toString(Object obj, int verboseLevel)fromwhatIs(Object),testObject(Object),testArrayObject(Object)andtestObjectArray(Object[]).static StringtestArrayObject(Object ao)Tests if the argumentaomatches an array object parameter.static StringtestBoolean(boolean value)Tests if the argumentvaluematches abooleanparameter.static StringtestBoolean(boolean x, boolean y)Tests if the argumentsxandymatch the given signature.static StringtestBooleanArray(boolean[] arr)Tests if the argumentarrmatches aboolean[]parameter.static StringtestBooleanWrapper(Boolean value)static StringtestByte(byte value)Tests if the argumentvaluematches abyteparameter.static StringtestByte(byte x, byte y)Tests if the argumentsxandymatch the given signature.static StringtestByteArray(byte[] arr)Tests if the argumentarrmatches abyte[]parameter.static StringtestByteWrapper(Byte value)static StringtestChar(char value)Tests if the argumentvaluematches acharparameter.static StringtestChar(char x, char y)Tests if the argumentsxandymatch the given signature.static StringtestCharArray(char[] arr)Tests if the argumentarrmatches achar[]parameter.static StringtestCharWrapper(Character value)static StringtestDouble(double value)Tests if the argumentvaluematches adoubleparameter.static StringtestDouble(double x, double y)Tests if the argumentsxandymatch the given signature.static StringtestDoubleArray(double[] arr)Tests if the argumentarrmatches adouble[]parameter.static StringtestDoubleWrapper(Double value)static StringtestFloat(float value)Tests if the argumentvaluematches afloatparameter.static StringtestFloat(float x, float y)Tests if the argumentsxandymatch the given signature.static StringtestFloatArray(float[] arr)Tests if the argumentarrmatches afloat[]parameter.static StringtestFloatWrapper(Float value)static StringtestInstance(Object o)Tests if the argumentvaluematches an Object parameter.static StringtestInstance(Object[] oa)Tests if the argumentvaluematches an Object [] parameter.static StringtestInstance(String value)Tests if the argumentvaluematches a String parameter.static StringtestInstance(String[] arr)Tests if the argumentvaluematches a String [] parameter.static StringtestInt(int value)Tests if the argumentvaluematches anintparameter.static StringtestInt(int x, int y)Tests if the argumentsxandymatch the given signature.static StringtestIntArray(int[] arr)Tests if the argumentarrmatches aint[]parameter.static StringtestIntWrapper(Integer value)static StringtestLong(long value)Tests if the argumentvaluematches alongparameter.static StringtestLong(long x, long y)Tests if the argumentsxandymatch the given signature.static StringtestLongArray(long[] arr)Tests if the argumentarrmatches along[]parameter.static StringtestLongWrapper(Long value)static StringtestNumber(Number value)static StringtestNumerical(double value)Tests if the argumentvaluematches a numerical parameter (doubleorlong).static StringtestNumerical(long value)Tests if the argumentvaluematches a numerical parameter (doubleorlong).static StringtestObject(Object o)static StringtestObject(Object x, Object y)Tests if the argumentsxandymatch the given signature.static StringtestObjectArray(Object[] oa)static StringtestPrimitive(boolean value)Tests if the argumentvaluematches a java primitive parameter.static StringtestPrimitive(byte value)Tests if the argumentvaluematches a java primitive parameter.static StringtestPrimitive(char value)Tests if the argumentvaluematches a java primitive parameter.static StringtestPrimitive(double value)Tests if the argumentvaluematches a java primitive parameter.static StringtestPrimitive(float value)Tests if the argumentvaluematches a java primitive parameter.static StringtestPrimitive(int value)Tests if the argumentvaluematches a java primitive parameter.static StringtestPrimitive(long value)Tests if the argumentvaluematches a java primitive parameter.static StringtestPrimitive(short value)Tests if the argumentvaluematches a java primitive parameter.static StringtestShort(short value)Tests if the argumentvaluematches ashortparameter.static StringtestShort(short x, short y)Tests if the argumentsxandymatch the given signature.static StringtestShortArray(short[] arr)Tests if the argumentarrmatches ashort[]parameter.static StringtestShortWrapper(Short value)static StringtestString(String value)static StringtestString(String x, String y)Tests if the argumentsxandymatch the given signature.static StringtestStringArray(String[] arr)static StringtestWrapper(Boolean value)Tests if the argumentvaluematches a java primitive wrapper parameter.static StringtestWrapper(Byte value)Tests if the argumentvaluematches a java primitive wrapper parameter.static StringtestWrapper(Character value)Tests if the argumentvaluematches a java primitive wrapper parameter.static StringtestWrapper(Double value)Tests if the argumentvaluematches a java primitive wrapper parameter.static StringtestWrapper(Float value)Tests if the argumentvaluematches a java primitive wrapper parameter.static StringtestWrapper(Integer value)Tests if the argumentvaluematches a java primitive wrapper parameter.static StringtestWrapper(Long value)Tests if the argumentvaluematches a java primitive wrapper parameter.static StringtestWrapper(Short value)Tests if the argumentvaluematches a java primitive wrapper parameter.static StringtestXY(boolean x, boolean y)Tests which signature is called for the given argumentsxandy.static StringtestXY(byte x, byte y)Tests which signature is called for the given argumentsxandy.static StringtestXY(char x, char y)Tests which signature is called for the given argumentsxandy.static StringtestXY(double x, double y)Tests which signature is called for the given argumentsxandy.static StringtestXY(float x, float y)Tests which signature is called for the given argumentsxandy.static StringtestXY(int x, int y)Tests which signature is called for the given argumentsxandy.static StringtestXY(long x, long y)Tests which signature is called for the given argumentsxandy.static StringtestXY(short x, short y)Tests which signature is called for the given argumentsxandy.static StringtestXY(Object x, Object y)Tests which signature is called for the given argumentsxandy.static StringtestXY(String x, String y)Tests which signature is called for the given argumentsxandy.static StringwhatIs(boolean value)Returns the type of the argumentvalue.static StringwhatIs(byte value)Returns the type of the argumentvalue.static StringwhatIs(char value)Returns the type of the argumentvalue.static StringwhatIs(double value)Returns the type of the argumentvalue.static StringwhatIs(float value)Returns the type of the argumentvalue.static StringwhatIs(int value)Returns the type of the argumentvalue.static StringwhatIs(long value)Returns the type of the argumentvalue.static StringwhatIs(short value)Returns the type of the argumentvalue.static StringwhatIs(Boolean value)Returns the type of the argumentvalue.static StringwhatIs(Byte value)Returns the type of the argumentvalue.static StringwhatIs(Character value)Returns the type of the argumentvalue.static StringwhatIs(Double value)Returns the type of the argumentvalue.static StringwhatIs(Float value)Returns the type of the argumentvalue.static StringwhatIs(Integer value)Returns the type of the argumentvalue.static StringwhatIs(Long value)Returns the type of the argumentvalue.static StringwhatIs(Object obj)Returns the type of the argumentobj.static StringwhatIs(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)
SetsverboseLevelfor 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 argumentvaluematches a String parameter.
-
testInstance
public static String testInstance(String[] arr)
Tests if the argumentvaluematches a String [] parameter.
-
testInstance
public static String testInstance(Object o)
Tests if the argumentvaluematches an Object parameter.
-
testInstance
public static String testInstance(Object[] oa)
Tests if the argumentvaluematches an Object [] parameter.
-
testNumerical
public static String testNumerical(double value)
Tests if the argumentvaluematches a numerical parameter (doubleorlong).
-
testNumerical
public static String testNumerical(long value)
Tests if the argumentvaluematches a numerical parameter (doubleorlong).
-
testPrimitive
public static String testPrimitive(double value)
Tests if the argumentvaluematches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(float value)
Tests if the argumentvaluematches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(long value)
Tests if the argumentvaluematches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(int value)
Tests if the argumentvaluematches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(short value)
Tests if the argumentvaluematches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(byte value)
Tests if the argumentvaluematches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(char value)
Tests if the argumentvaluematches a java primitive parameter.
-
testPrimitive
public static String testPrimitive(boolean value)
Tests if the argumentvaluematches a java primitive parameter.
-
testWrapper
public static String testWrapper(Double value)
Tests if the argumentvaluematches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Float value)
Tests if the argumentvaluematches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Long value)
Tests if the argumentvaluematches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Integer value)
Tests if the argumentvaluematches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Short value)
Tests if the argumentvaluematches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Byte value)
Tests if the argumentvaluematches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Character value)
Tests if the argumentvaluematches a java primitive wrapper parameter.
-
testWrapper
public static String testWrapper(Boolean value)
Tests if the argumentvaluematches a java primitive wrapper parameter.
-
testDouble
public static String testDouble(double value)
Tests if the argumentvaluematches adoubleparameter.
-
testFloat
public static String testFloat(float value)
Tests if the argumentvaluematches afloatparameter.
-
testLong
public static String testLong(long value)
Tests if the argumentvaluematches alongparameter.
-
testInt
public static String testInt(int value)
Tests if the argumentvaluematches anintparameter.
-
testShort
public static String testShort(short value)
Tests if the argumentvaluematches ashortparameter.
-
testByte
public static String testByte(byte value)
Tests if the argumentvaluematches abyteparameter.
-
testChar
public static String testChar(char value)
Tests if the argumentvaluematches acharparameter.
-
testBoolean
public static String testBoolean(boolean value)
Tests if the argumentvaluematches abooleanparameter.
-
testArrayObject
public static String testArrayObject(Object ao)
Tests if the argumentaomatches an array object parameter.
-
testDoubleArray
public static String testDoubleArray(double[] arr)
Tests if the argumentarrmatches adouble[]parameter.
-
testFloatArray
public static String testFloatArray(float[] arr)
Tests if the argumentarrmatches afloat[]parameter.
-
testLongArray
public static String testLongArray(long[] arr)
Tests if the argumentarrmatches along[]parameter.
-
testIntArray
public static String testIntArray(int[] arr)
Tests if the argumentarrmatches aint[]parameter.
-
testShortArray
public static String testShortArray(short[] arr)
Tests if the argumentarrmatches ashort[]parameter.
-
testByteArray
public static String testByteArray(byte[] arr)
Tests if the argumentarrmatches abyte[]parameter.
-
testCharArray
public static String testCharArray(char[] arr)
Tests if the argumentarrmatches achar[]parameter.
-
testBooleanArray
public static String testBooleanArray(boolean[] arr)
Tests if the argumentarrmatches aboolean[]parameter.
-
testDouble
public static String testDouble(double x, double y)
Tests if the argumentsxandymatch the given signature.
-
testFloat
public static String testFloat(float x, float y)
Tests if the argumentsxandymatch the given signature.
-
testLong
public static String testLong(long x, long y)
Tests if the argumentsxandymatch the given signature.
-
testInt
public static String testInt(int x, int y)
Tests if the argumentsxandymatch the given signature.
-
testShort
public static String testShort(short x, short y)
Tests if the argumentsxandymatch the given signature.
-
testByte
public static String testByte(byte x, byte y)
Tests if the argumentsxandymatch the given signature.
-
testChar
public static String testChar(char x, char y)
Tests if the argumentsxandymatch the given signature.
-
testBoolean
public static String testBoolean(boolean x, boolean y)
Tests if the argumentsxandymatch the given signature.
-
testString
public static String testString(String x, String y)
Tests if the argumentsxandymatch the given signature.
-
testObject
public static String testObject(Object x, Object y)
Tests if the argumentsxandymatch the given signature.
-
testXY
public static String testXY(double x, double y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(float x, float y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(long x, long y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(int x, int y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(short x, short y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(byte x, byte y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(char x, char y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(boolean x, boolean y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(String x, String y)
Tests which signature is called for the given argumentsxandy.
-
testXY
public static String testXY(Object x, Object y)
Tests which signature is called for the given argumentsxandy.
-
asDouble
public static double asDouble(double value)
Returns the argumentvalueasdouble.
-
asFloat
public static float asFloat(float value)
Returns the argumentvalueasfloat.
-
asLong
public static long asLong(long value)
Returns the argumentvalueaslong.
-
asInt
public static int asInt(int value)
Returns the argumentvalueasint.
-
asShort
public static short asShort(short value)
Returns the argumentvalueasshort.
-
asByte
public static byte asByte(byte value)
Returns the argumentvalueasbyte.
-
asChar
public static char asChar(char value)
Returns the argumentvalueaschar.
-
asBoolean
public static boolean asBoolean(boolean value)
Returns the argumentvalueasboolean.
-
-