Class 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 argument value of given type matches a method parameter of type T :  testT(value).
    ... the transfer of an argument value to a method parameter of type T :  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
     
    See Also:
    JxnObject, JxnCast
    • Method Detail

      • whatIs

        public static String whatIs​(double value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Double value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(float value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Float value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(long value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Long value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(int value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Integer value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(short value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Short value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(byte value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Byte value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(char value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Character value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(boolean value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Boolean value)
        Returns the type of the argument value.
      • whatIs

        public static String whatIs​(Object obj)
        Returns the type of the argument obj.
      • testInstance

        public static String testInstance​(String value)
        Tests if the argument value matches a String parameter.
      • testInstance

        public static String testInstance​(String[] arr)
        Tests if the argument value matches a String [] parameter.
      • testInstance

        public static String testInstance​(Object o)
        Tests if the argument value matches an Object parameter.
      • testInstance

        public static String testInstance​(Object[] oa)
        Tests if the argument value matches an Object [] parameter.
      • testNumerical

        public static String testNumerical​(double value)
        Tests if the argument value matches a numerical parameter (double or long).
      • testNumerical

        public static String testNumerical​(long value)
        Tests if the argument value matches a numerical parameter (double or long).
      • testPrimitive

        public static String testPrimitive​(double value)
        Tests if the argument value matches a java primitive parameter.
      • testPrimitive

        public static String testPrimitive​(float value)
        Tests if the argument value matches a java primitive parameter.
      • testPrimitive

        public static String testPrimitive​(long value)
        Tests if the argument value matches a java primitive parameter.
      • testPrimitive

        public static String testPrimitive​(int value)
        Tests if the argument value matches a java primitive parameter.
      • testPrimitive

        public static String testPrimitive​(short value)
        Tests if the argument value matches a java primitive parameter.
      • testPrimitive

        public static String testPrimitive​(byte value)
        Tests if the argument value matches a java primitive parameter.
      • testPrimitive

        public static String testPrimitive​(char value)
        Tests if the argument value matches a java primitive parameter.
      • testPrimitive

        public static String testPrimitive​(boolean value)
        Tests if the argument value matches a java primitive parameter.
      • testWrapper

        public static String testWrapper​(Double value)
        Tests if the argument value matches a java primitive wrapper parameter.
      • testWrapper

        public static String testWrapper​(Float value)
        Tests if the argument value matches a java primitive wrapper parameter.
      • testWrapper

        public static String testWrapper​(Long value)
        Tests if the argument value matches a java primitive wrapper parameter.
      • testWrapper

        public static String testWrapper​(Integer value)
        Tests if the argument value matches a java primitive wrapper parameter.
      • testWrapper

        public static String testWrapper​(Short value)
        Tests if the argument value matches a java primitive wrapper parameter.
      • testWrapper

        public static String testWrapper​(Byte value)
        Tests if the argument value matches a java primitive wrapper parameter.
      • testWrapper

        public static String testWrapper​(Character value)
        Tests if the argument value matches a java primitive wrapper parameter.
      • testWrapper

        public static String testWrapper​(Boolean value)
        Tests if the argument value matches a java primitive wrapper parameter.
      • testDouble

        public static String testDouble​(double value)
        Tests if the argument value matches a double parameter.
      • testFloat

        public static String testFloat​(float value)
        Tests if the argument value matches a float parameter.
      • testLong

        public static String testLong​(long value)
        Tests if the argument value matches a long parameter.
      • testInt

        public static String testInt​(int value)
        Tests if the argument value matches an int parameter.
      • testShort

        public static String testShort​(short value)
        Tests if the argument value matches a short parameter.
      • testByte

        public static String testByte​(byte value)
        Tests if the argument value matches a byte parameter.
      • testChar

        public static String testChar​(char value)
        Tests if the argument value matches a char parameter.
      • testBoolean

        public static String testBoolean​(boolean value)
        Tests if the argument value matches a boolean parameter.
      • testDoubleWrapper

        public static String testDoubleWrapper​(Double value)
        Tests if the argument value matches a java.lang.Double parameter.
      • testFloatWrapper

        public static String testFloatWrapper​(Float value)
        Tests if the argument value matches a java.lang.Float parameter.
      • testLongWrapper

        public static String testLongWrapper​(Long value)
        Tests if the argument value matches a java.lang.Long parameter.
      • testIntWrapper

        public static String testIntWrapper​(Integer value)
        Tests if the argument value matches a java.lang.Integer parameter.
      • testShortWrapper

        public static String testShortWrapper​(Short value)
        Tests if the argument value matches a java.lang.Short parameter.
      • testByteWrapper

        public static String testByteWrapper​(Byte value)
        Tests if the argument value matches a java.lang.Byte parameter.
      • testCharWrapper

        public static String testCharWrapper​(Character value)
        Tests if the argument value matches a java.lang.Character parameter.
      • testBooleanWrapper

        public static String testBooleanWrapper​(Boolean value)
        Tests if the argument value matches a java.lang.Boolean parameter.
      • testNumber

        public static String testNumber​(Number value)
        Tests if the argument value matches a java.lang.Number parameter.
      • testString

        public static String testString​(String value)
        Tests if the argument value matches a java.lang.String parameter.
      • testObject

        public static String testObject​(Object o)
        Tests if the argument o matches a java.lang.Object parameter.
      • testArrayObject

        public static String testArrayObject​(Object ao)
        Tests if the argument ao matches an array object parameter.
      • testObjectArray

        public static String testObjectArray​(Object[] oa)
        Tests if the argument oa matches a java.lang.Object[] parameter.
      • testStringArray

        public static String testStringArray​(String[] arr)
        Tests if the argument arr matches a java.lang.String[] parameter.
      • testDoubleArray

        public static String testDoubleArray​(double[] arr)
        Tests if the argument arr matches a double[] parameter.
      • testFloatArray

        public static String testFloatArray​(float[] arr)
        Tests if the argument arr matches a float[] parameter.
      • testLongArray

        public static String testLongArray​(long[] arr)
        Tests if the argument arr matches a long[] parameter.
      • testIntArray

        public static String testIntArray​(int[] arr)
        Tests if the argument arr matches a int[] parameter.
      • testShortArray

        public static String testShortArray​(short[] arr)
        Tests if the argument arr matches a short[] parameter.
      • testByteArray

        public static String testByteArray​(byte[] arr)
        Tests if the argument arr matches a byte[] parameter.
      • testCharArray

        public static String testCharArray​(char[] arr)
        Tests if the argument arr matches a char[] parameter.
      • testBooleanArray

        public static String testBooleanArray​(boolean[] arr)
        Tests if the argument arr matches a boolean[] parameter.
      • testDouble

        public static String testDouble​(double x,
                                        double y)
        Tests if the arguments x and y match the given signature.
      • testFloat

        public static String testFloat​(float x,
                                       float y)
        Tests if the arguments x and y match the given signature.
      • testLong

        public static String testLong​(long x,
                                      long y)
        Tests if the arguments x and y match the given signature.
      • testInt

        public static String testInt​(int x,
                                     int y)
        Tests if the arguments x and y match the given signature.
      • testShort

        public static String testShort​(short x,
                                       short y)
        Tests if the arguments x and y match the given signature.
      • testByte

        public static String testByte​(byte x,
                                      byte y)
        Tests if the arguments x and y match the given signature.
      • testChar

        public static String testChar​(char x,
                                      char y)
        Tests if the arguments x and y match the given signature.
      • testBoolean

        public static String testBoolean​(boolean x,
                                         boolean y)
        Tests if the arguments x and y match the given signature.
      • testString

        public static String testString​(String x,
                                        String y)
        Tests if the arguments x and y match the given signature.
      • testObject

        public static String testObject​(Object x,
                                        Object y)
        Tests if the arguments x and y match the given signature.
      • testXY

        public static String testXY​(double x,
                                    double y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(float x,
                                    float y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(long x,
                                    long y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(int x,
                                    int y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(short x,
                                    short y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(byte x,
                                    byte y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(char x,
                                    char y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(boolean x,
                                    boolean y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(String x,
                                    String y)
        Tests which signature is called for the given arguments x and y.
      • testXY

        public static String testXY​(Object x,
                                    Object y)
        Tests which signature is called for the given arguments x and y.
      • asDouble

        public static double asDouble​(double value)
        Returns the argument value as double.
      • asFloat

        public static float asFloat​(float value)
        Returns the argument value as float.
      • asLong

        public static long asLong​(long value)
        Returns the argument value as long.
      • asInt

        public static int asInt​(int value)
        Returns the argument value as int.
      • asShort

        public static short asShort​(short value)
        Returns the argument value as short.
      • asByte

        public static byte asByte​(byte value)
        Returns the argument value as byte.
      • asChar

        public static char asChar​(char value)
        Returns the argument value as char.
      • asBoolean

        public static boolean asBoolean​(boolean value)
        Returns the argument value as boolean.
      • asString

        public static String asString​(String value)
        Returns the argument value as java.lang.String.
      • asObject

        public static Object asObject​(Object o)
        Returns the argument o as java.lang.Object (simply returns o).