Class StringObjectPromoter


  • public class StringObjectPromoter
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isAssignableForConstructor​(java.lang.Class<?> have, java.lang.Class<?> need)
      If a boxed type would suffice for a constructor call, even though Class.isAssignableFrom(Class) says the assignment wouldn't work, return true;
      static java.lang.Object promote​(java.lang.String stringArg)
      Specialize the form of a string argument around the apparent object type.
      static java.lang.Object promote​(java.lang.String raw, java.lang.Class<?> targetType)
      Specialize the type of an object according to a target class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringObjectPromoter

        public StringObjectPromoter()
    • Method Detail

      • promote

        public static java.lang.Object promote​(java.lang.String raw,
                                               java.lang.Class<?> targetType)
        Specialize the type of an object according to a target class.
        Parameters:
        raw - The string representation of an object.
        targetType - The target object type
        Returns:
        The promoted form, in the target class, or the original value if the format failed or the class type was not supported.
      • promote

        public static java.lang.Object promote​(java.lang.String stringArg)
        Specialize the form of a string argument around the apparent object type.
        Parameters:
        stringArg - The raw value in string form
        Returns:
        the specialized object type, or the original string format if nothing was found to be
      • isAssignableForConstructor

        public static boolean isAssignableForConstructor​(java.lang.Class<?> have,
                                                         java.lang.Class<?> need)
        If a boxed type would suffice for a constructor call, even though Class.isAssignableFrom(Class) says the assignment wouldn't work, return true;
        Parameters:
        have - The class that we have.
        need - The class that we need.
        Returns:
        true, if the class that we have would work for a constructor call, due to unboxing.