Package io.virtdata.util
Class StringObjectPromoter
- java.lang.Object
-
- io.virtdata.util.StringObjectPromoter
-
public class StringObjectPromoter extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description StringObjectPromoter()
-
Method Summary
Modifier and Type Method Description static booleanisAssignableForConstructor(java.lang.Class<?> have, java.lang.Class<?> need)If a boxed type would suffice for a constructor call, even thoughClass.isAssignableFrom(Class)says the assignment wouldn't work, return true;static java.lang.Objectpromote(java.lang.String stringArg)Specialize the form of a string argument around the apparent object type.static java.lang.Objectpromote(java.lang.String raw, java.lang.Class<?> targetType)Specialize the type of an object according to a target class.
-
-
-
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 thoughClass.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.
-
-