private boolean isArray(final Type type) { return Types.component(type) != null; }
private boolean isArray(final Type type) { return Types.component(type) != null; }
/** @deprecated Use {@link Types#component} instead. */ @Deprecated public static Type getComponentType(final Type type) { return Types.component(type); }
/** @deprecated Use {@link Types#component} instead. */ @Deprecated public static Type getComponentType(final Type type) { return Types.component(type); }
/** @deprecated use {@link Types#raws} and {@link Types#component} */ @Deprecated public static Class<?> getComponentClass(final Type type) { return Types.raw(Types.component(type)); }
/** * @deprecated Use {@link Types#component} and {@link Types#raw} instead. */ @Deprecated public static Class<?> getComponentClass(final Type type) { return Types.raw(Types.component(type)); }
/** * Gets a string representation of the given type. * * @param t Type whose name is desired. * @return The name of the given type. */ public static String name(final Type t) { if (t instanceof Class) { final Class<?> c = (Class<?>) t; return c.isArray() ? (name(component(c)) + "[]") : c.getName(); } return t.toString(); }
/** @deprecated use {@link Types#raws} and {@link Types#component} */ @Deprecated public static Class<?> getComponentClass(final Type type) { return Types.raw(Types.component(type)); }
/** * @deprecated Use {@link Types#component} and {@link Types#raw} instead. */ @Deprecated public static Class<?> getComponentClass(final Type type) { return Types.raw(Types.component(type)); }
/** * Gets a string representation of the given type. * * @param t Type whose name is desired. * @return The name of the given type. */ public static String name(final Type t) { if (t instanceof Class) { final Class<?> c = (Class<?>) t; return c.isArray() ? (name(component(c)) + "[]") : c.getName(); } return t.toString(); }
T array = (T) convertToArray(src, Types.raw(Types.component(dest))); return array;
T array = (T) convertToArray(src, Types.raw(Types.component(dest))); return array;
/** Convenience method to call {@link Types#component} on a field. */ private Class<?> componentType(final Class<?> c, final String fieldName) { return Types.raw(Types.component(type(c, fieldName))); }
@Override public Object convert(final Object src, final Type dest) { // Handle array types, including generic array types. final Type componentType = Types.component(dest); if (componentType != null) { // NB: Destination is an array type. return convertToArray(src, Types.raw(componentType)); } // Handle parameterized collection types. if (dest instanceof ParameterizedType && isCollection(dest)) { return convertToCollection(src, (ParameterizedType) dest); } // This wasn't a collection or array, so convert it as a single element. return convert(src, Types.raw(dest)); }
@Override public Object convert(final Object src, final Type dest) { // Handle array types, including generic array types. final Type componentType = Types.component(dest); if (componentType != null) { // NB: Destination is an array type. return convertToArray(src, Types.raw(componentType)); } // Handle parameterized collection types. if (dest instanceof ParameterizedType && isCollection(dest)) { return convertToCollection(src, (ParameterizedType) dest); } // This wasn't a collection or array, so convert it as a single element. return convert(src, Types.raw(dest)); }