@Override public boolean remove(final Object o) { if (!compatibleClass(o)) return false; final E value = Types.cast(o, objectClass); return removeValue(value); }
/** * Converts the given object to a {@link Number} of the specified type, or * null if the types are incompatible. */ public static Number toNumber(final Object value, final Class<?> type) { final Object num = ConversionUtils.convert(value, type); return num == null ? null : Types.cast(num, Number.class); }
/** * Create a generic array type instance. * * @param componentType the type of the elements of the array. For example * the component type of {@code boolean[]} is {@code boolean} * @return {@link GenericArrayType} * @since 3.2 */ public static GenericArrayType genericArrayType(final Type componentType) { return new GenericArrayTypeImpl(validateNotNull(componentType, "componentType is null")); }
private Class<?> getClass(final Object code) { if (code instanceof Class) return (Class<?>) code; if (code instanceof String) return Types.load((String) code); return null; }
/** * Adds the most recently issued command. * * @param command the most recent command to add to the history */ public void add(final String command) { entries.add(command); position = -1; currentCommand = ""; }
/** * @return Source class for conversion or lookup. */ public Class<?> sourceClass() { return Types.raw(srcType); }
@Override public void setSize(final int size) { ensureCapacity(size); this.size = size; }
@Override public boolean removeAll(final Collection<?> c) { boolean changed = false; for (final Object o : c) { if (!compatibleClass(o)) continue; final E value = Types.cast(o, objectClass); final boolean result = removeValue(value); if (result) changed = true; } return changed; }
/** * Converts the given object to a {@link Number} of the specified type, or * null if the types are incompatible. */ public static Number toNumber(final Object value, final Class<?> type) { final Object num = ConversionUtils.convert(value, type); return num == null ? null : Types.cast(num, Number.class); }
/** * Create a generic array type instance. * * @param componentType the type of the elements of the array. For example * the component type of {@code boolean[]} is {@code boolean} * @return {@link GenericArrayType} * @since 3.2 */ public static GenericArrayType genericArrayType(final Type componentType) { return new GenericArrayTypeImpl(validateNotNull(componentType, "componentType is null")); }
@Override public boolean remove(final Object o) { if (!compatibleClass(o)) return false; final E value = Types.cast(o, objectClass); return removeValue(value); }
@Override public boolean removeAll(final Collection<?> c) { boolean changed = false; for (final Object o : c) { if (!compatibleClass(o)) continue; final E value = Types.cast(o, objectClass); final boolean result = removeValue(value); if (result) changed = true; } return changed; }