Class PlasticUtils

    • Method Detail

      • nextUID

        public static String nextUID()
        Returns a string that can be used as part of a Java identifier and is unique for this JVM. Currently returns a hexadecimal string and initialized by System.nanoTime() (but both those details may change in the future). Note that the returned value may start with a numeric digit, so it should be used as a suffix, not prefix of a Java identifier.
        unique id that can be used as part of a Java identifier
      • toTypeName

        public static String toTypeName​(Class type)
        Converts a type (including array and primitive types) to their type name (the way they are represented in Java source files).
      • toTypeNames

        public static String[] toTypeNames​(Class[] types)
        Converts a number of types (usually, arguments to a method or constructor) into their type names.
      • toWrapperType

        public static Class toWrapperType​(Class type)
        Gets the wrapper type for a given type (if primitive)
        type - type to look up
        the input type for non-primitive type, or corresponding wrapper type (Boolean.class for boolean.class, etc.)
      • getMethod

        public static Method getMethod​(Class declaringClass,
                                       String name,
                                       Class... parameterTypes)
        Convenience for getting a method from a class.
        declaringClass - containing class
        name - name of method
        parameterTypes - types of parameters
        the Method
        RuntimeException - if any error (such as method not found)
      • isPrimitive

        public static boolean isPrimitive​(String typeName)
        Determines if the provided type name is a primitive type.
        typeName - Java type name, such as "boolean" or "java.lang.String"
        true if primitive