/** * Returns a readable name for this class (e.g. <js>"java.lang.String"</js>, <js>"boolean[]"</js>). * * @return The readable name for this class. */ public String getReadableName() { return getReadableClassName(this.innerClass); }
/** * @param toType Attempting to convert to this class type. * @param cause The cause. * @param value The value being converted. */ public InvalidDataConversionException(Object value, Class<?> toType, Exception cause) { this(cause, "Invalid data conversion from type ''{0}'' to type ''{1}''. Value={2}.", getReadableClassNameForObject(value), getReadableClassName(toType), getValue(value)); }
/** * Returns a readable name for this class (e.g. <js>"java.lang.String"</js>, <js>"boolean[]"</js>). * * @return The readable name for this class. */ public String getReadableName() { return getReadableClassName(this.innerClass); }
/** * @param toType Attempting to convert to this class type. * @param cause The cause. * @param value The value being converted. */ public InvalidDataConversionException(Object value, Class<?> toType, Exception cause) { this(cause, "Invalid data conversion from type ''{0}'' to type ''{1}''. Value={2}.", getReadableClassNameForObject(value), getReadableClassName(toType), getValue(value)); }
/** * Returns a readable name for this class (e.g. <js>"java.lang.String"</js>, <js>"boolean[]"</js>). * * @return The readable name for this class. */ public String getReadableName() { return getReadableClassName(this.innerClass); }
/** * @param toType Attempting to convert to this class type. * @param cause The cause. * @param value The value being converted. */ public InvalidDataConversionException(Object value, Class<?> toType, Exception cause) { this(cause, "Invalid data conversion from type ''{0}'' to type ''{1}''. Value={2}.", getReadableClassNameForObject(value), getReadableClassName(toType), getValue(value)); }
/** * Shortcut for calling <code><jsm>getReadableClassName</jsm>(c.getName())</code> * * @param c The class. * @return A readable class type name, or <jk>null</jk> if parameter is <jk>null</jk>. */ public static String getReadableClassName(Class<?> c) { if (c == null) return null; return getReadableClassName(c.getName()); }
/** * Shortcut for calling <code><jsm>getReadableClassName</jsm>(c.getName())</code> * * @param c The class. * @return A readable class type name, or <jk>null</jk> if parameter is <jk>null</jk>. */ public static String getReadableClassName(Class<?> c) { if (c == null) return null; return getReadableClassName(c.getName()); }
/** * Shortcut for calling <code><jsm>getReadableClassName</jsm>(c.getName())</code> * * @param c The class. * @return A readable class type name, or <jk>null</jk> if parameter is <jk>null</jk>. */ public static String getReadableClassName(Class<?> c) { if (c == null) return null; return getReadableClassName(c.getName()); }
/** * Shortcut for calling <code><jsm>getReadableClassName</jsm>(c.getClass().getName())</code> * * @param o The object whose class we want to render. * @return A readable class type name, or <jk>null</jk> if parameter is <jk>null</jk>. */ public static String getReadableClassNameForObject(Object o) { if (o == null) return null; return getReadableClassName(o.getClass().getName()); }
private static String getValue(Object o) { if (o instanceof Class) return "'" + getReadableClassName((Class<?>)o) + "'"; return SimpleJsonSerializer.DEFAULT == null ? "'" + o.toString() + "'" : SimpleJsonSerializer.DEFAULT.toString(o); } }
private static String getValue(Object o) { if (o instanceof Class) return "'" + getReadableClassName((Class<?>)o) + "'"; return SimpleJsonSerializer.DEFAULT == null ? "'" + o.toString() + "'" : SimpleJsonSerializer.DEFAULT.toString(o); } }
/** * Shortcut for calling <code><jsm>getReadableClassName</jsm>(c.getClass().getName())</code> * * @param o The object whose class we want to render. * @return A readable class type name, or <jk>null</jk> if parameter is <jk>null</jk>. */ public static String getReadableClassNameForObject(Object o) { if (o == null) return null; return getReadableClassName(o.getClass().getName()); }
private static String getValue(Object o) { if (o instanceof Class) return "'" + getReadableClassName((Class<?>)o) + "'"; return SimpleJsonSerializer.DEFAULT == null ? "'" + o.toString() + "'" : SimpleJsonSerializer.DEFAULT.toString(o); } }
/** * Shortcut for calling <code><jsm>getReadableClassName</jsm>(c.getClass().getName())</code> * * @param o The object whose class we want to render. * @return A readable class type name, or <jk>null</jk> if parameter is <jk>null</jk>. */ public static String getReadableClassNameForObject(Object o) { if (o == null) return null; return getReadableClassName(o.getClass().getName()); }
/** * Given a Java method, returns the arguments signature. * * @param m The Java method. * @param full Whether fully-qualified names should be used for arguments. * @return The arguments signature for the specified method. */ public static String getMethodArgsSignature(Method m, boolean full) { StringBuilder sb = new StringBuilder(); Class<?>[] pt = m.getParameterTypes(); if (pt.length == 0) return ""; sb.append('('); for (int i = 0; i < pt.length; i++) { if (i > 0) sb.append(','); sb.append(full ? ClassUtils.getReadableClassName(pt[i]) : ClassUtils.getSimpleName(pt[i])); } sb.append(')'); return sb.toString(); } }
/** * Given the specified list of objects, return readable names for the class types of the objects. * * @param o The objects. * @return An array of readable class type strings. */ public static ObjectList getReadableClassNames(Object[] o) { ObjectList l = new ObjectList(); for (int i = 0; i < o.length; i++) l.add(o[i] == null ? "null" : getReadableClassName(o[i].getClass())); return l; }
/** * Given the specified list of objects, return readable names for the class types of the objects. * * @param o The objects. * @return An array of readable class type strings. */ public static ObjectList getReadableClassNames(Object[] o) { ObjectList l = new ObjectList(); for (int i = 0; i < o.length; i++) l.add(o[i] == null ? "null" : getReadableClassName(o[i].getClass())); return l; }
/** * Given the specified list of objects, return readable names for the class types of the objects. * * @param o The objects. * @return An array of readable class type strings. */ public static ObjectList getReadableClassNames(Object[] o) { ObjectList l = new ObjectList(); for (int i = 0; i < o.length; i++) l.add(o[i] == null ? "null" : getReadableClassName(o[i].getClass())); return l; }
/** * Converts the specified object to a <code>String</code>. * * <p> * Also has the following effects: * <ul> * <li><code>Class</code> object is converted to a readable name. See {@link ClassUtils#getReadableClassName(Class)}. * <li>Whitespace is trimmed if the trim-strings setting is enabled. * </ul> * * @param o The object to convert to a <code>String</code>. * @return The object converted to a String, or <jk>null</jk> if the input was <jk>null</jk>. */ public final String toString(Object o) { if (o == null) return null; if (o.getClass() == Class.class) return getReadableClassName((Class<?>)o); if (o.getClass().isEnum()) return getClassMetaForObject(o).toString(o); String s = o.toString(); if (isTrimStrings()) s = s.trim(); return s; }