/** * Creates a Predicate that checks if the object passed in is of * a particular type, using instanceof. A <code>null</code> input * object will return <code>false</code>. * * @see org.apache.commons.collections.functors.InstanceofPredicate * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate instanceofPredicate(Class type) { return InstanceofPredicate.getInstance(type); }
/** * Creates a Predicate that checks if the object passed in is of * a particular type, using instanceof. A <code>null</code> input * object will return <code>false</code>. * * @see org.apache.commons.collections.functors.InstanceofPredicate * * @param type the type to check for, may not be null * @return the predicate * @throws IllegalArgumentException if the class is null */ public static Predicate instanceofPredicate(Class type) { return InstanceofPredicate.getInstance(type); }
/** * Factory method to create a typed map. * <p> * If there are any elements already in the map being decorated, they * are validated. * * @param map the map to decorate, must not be null * @param keyType the type to allow as keys, must not be null * @param valueType the type to allow as values, must not be null * @throws IllegalArgumentException if list or type is null * @throws IllegalArgumentException if the list contains invalid elements */ public static Map decorate(Map map, Class keyType, Class valueType) { return new PredicatedMap( map, InstanceofPredicate.getInstance(keyType), InstanceofPredicate.getInstance(valueType) ); }
/** * Factory method to create a typed sorted map. * <p> * If there are any elements already in the map being decorated, they * are validated. * * @param map the map to decorate, must not be null * @param keyType the type to allow as keys, must not be null * @param valueType the type to allow as values, must not be null * @throws IllegalArgumentException if list or type is null * @throws IllegalArgumentException if the list contains invalid elements */ public static SortedMap decorate(SortedMap map, Class keyType, Class valueType) { return new PredicatedSortedMap( map, InstanceofPredicate.getInstance(keyType), InstanceofPredicate.getInstance(valueType) ); }
/** * Factory method to create a typed sorted map. * <p> * If there are any elements already in the map being decorated, they * are validated. * * @param map the map to decorate, must not be null * @param keyType the type to allow as keys, must not be null * @param valueType the type to allow as values, must not be null * @throws IllegalArgumentException if list or type is null * @throws IllegalArgumentException if the list contains invalid elements */ public static SortedMap decorate(SortedMap map, Class keyType, Class valueType) { return new PredicatedSortedMap( map, InstanceofPredicate.getInstance(keyType), InstanceofPredicate.getInstance(valueType) ); }
/** * Factory method to create a typed map. * <p> * If there are any elements already in the map being decorated, they * are validated. * * @param map the map to decorate, must not be null * @param keyType the type to allow as keys, must not be null * @param valueType the type to allow as values, must not be null * @throws IllegalArgumentException if list or type is null * @throws IllegalArgumentException if the list contains invalid elements */ public static Map decorate(Map map, Class keyType, Class valueType) { return new PredicatedMap( map, InstanceofPredicate.getInstance(keyType), InstanceofPredicate.getInstance(valueType) ); }
/** * Factory method to create a typed list. * <p> * If there are any elements already in the list being decorated, they * are validated. * * @param list the list to decorate, must not be null * @param type the type to allow into the collection, must not be null * @throws IllegalArgumentException if list or type is null * @throws IllegalArgumentException if the list contains invalid elements */ public static List decorate(List list, Class type) { return new PredicatedList(list, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed sorted set. * <p> * If there are any elements already in the set being decorated, they * are validated. * * @param set the set to decorate, must not be null * @param type the type to allow into the collection, must not be null * @throws IllegalArgumentException if set or type is null * @throws IllegalArgumentException if the set contains invalid elements */ public static SortedSet decorate(SortedSet set, Class type) { return new PredicatedSortedSet(set, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed list. * <p> * If there are any elements already in the buffer being decorated, they * are validated. * * @param buffer the buffer to decorate, must not be null * @param type the type to allow into the buffer, must not be null * @return a new typed Buffer * @throws IllegalArgumentException if buffer or type is null * @throws IllegalArgumentException if the buffer contains invalid elements */ public static Buffer decorate(Buffer buffer, Class type) { return new PredicatedBuffer(buffer, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed sorted bag. * <p> * If there are any elements already in the bag being decorated, they * are validated. * * @param bag the bag to decorate, must not be null * @param type the type to allow into the bag, must not be null * @return a new transformed SortedBag * @throws IllegalArgumentException if bag or type is null * @throws IllegalArgumentException if the bag contains invalid elements */ public static SortedBag decorate(SortedBag bag, Class type) { return new PredicatedSortedBag(bag, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed set. * <p> * If there are any elements already in the set being decorated, they * are validated. * * @param set the set to decorate, must not be null * @param type the type to allow into the collection, must not be null * @throws IllegalArgumentException if set or type is null * @throws IllegalArgumentException if the set contains invalid elements */ public static Set decorate(Set set, Class type) { return new PredicatedSet(set, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed bag. * <p> * If there are any elements already in the bag being decorated, they * are validated. * * @param bag the bag to decorate, must not be null * @param type the type to allow into the bag, must not be null * @return a new typed Bag * @throws IllegalArgumentException if bag or type is null * @throws IllegalArgumentException if the bag contains invalid elements */ public static Bag decorate(Bag bag, Class type) { return new PredicatedBag(bag, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed collection. * <p> * If there are any elements already in the collection being decorated, they * are validated. * * @param coll the collection to decorate, must not be null * @param type the type to allow into the collection, must not be null * @return a new typed collection * @throws IllegalArgumentException if collection or type is null * @throws IllegalArgumentException if the collection contains invalid elements */ public static Collection decorate(Collection coll, Class type) { return new PredicatedCollection(coll, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed bag. * <p> * If there are any elements already in the bag being decorated, they * are validated. * * @param bag the bag to decorate, must not be null * @param type the type to allow into the bag, must not be null * @return a new typed Bag * @throws IllegalArgumentException if bag or type is null * @throws IllegalArgumentException if the bag contains invalid elements */ public static Bag decorate(Bag bag, Class type) { return new PredicatedBag(bag, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed set. * <p> * If there are any elements already in the set being decorated, they * are validated. * * @param set the set to decorate, must not be null * @param type the type to allow into the collection, must not be null * @throws IllegalArgumentException if set or type is null * @throws IllegalArgumentException if the set contains invalid elements */ public static Set decorate(Set set, Class type) { return new PredicatedSet(set, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed list. * <p> * If there are any elements already in the list being decorated, they * are validated. * * @param list the list to decorate, must not be null * @param type the type to allow into the collection, must not be null * @throws IllegalArgumentException if list or type is null * @throws IllegalArgumentException if the list contains invalid elements */ public static List decorate(List list, Class type) { return new PredicatedList(list, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed collection. * <p> * If there are any elements already in the collection being decorated, they * are validated. * * @param coll the collection to decorate, must not be null * @param type the type to allow into the collection, must not be null * @return a new typed collection * @throws IllegalArgumentException if collection or type is null * @throws IllegalArgumentException if the collection contains invalid elements */ public static Collection decorate(Collection coll, Class type) { return new PredicatedCollection(coll, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed list. * <p> * If there are any elements already in the buffer being decorated, they * are validated. * * @param buffer the buffer to decorate, must not be null * @param type the type to allow into the buffer, must not be null * @return a new typed Buffer * @throws IllegalArgumentException if buffer or type is null * @throws IllegalArgumentException if the buffer contains invalid elements */ public static Buffer decorate(Buffer buffer, Class type) { return new PredicatedBuffer(buffer, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed sorted set. * <p> * If there are any elements already in the set being decorated, they * are validated. * * @param set the set to decorate, must not be null * @param type the type to allow into the collection, must not be null * @throws IllegalArgumentException if set or type is null * @throws IllegalArgumentException if the set contains invalid elements */ public static SortedSet decorate(SortedSet set, Class type) { return new PredicatedSortedSet(set, InstanceofPredicate.getInstance(type)); }
/** * Factory method to create a typed sorted bag. * <p> * If there are any elements already in the bag being decorated, they * are validated. * * @param bag the bag to decorate, must not be null * @param type the type to allow into the bag, must not be null * @return a new transformed SortedBag * @throws IllegalArgumentException if bag or type is null * @throws IllegalArgumentException if the bag contains invalid elements */ public static SortedBag decorate(SortedBag bag, Class type) { return new PredicatedSortedBag(bag, InstanceofPredicate.getInstance(type)); }