/** * Returns a predicated (validating) buffer backed by the given buffer. * <p> * Only objects that pass the test in the given predicate can be added to the buffer. * Trying to add an invalid object results in an IllegalArgumentException. * It is important not to use the original buffer after invoking this method, * as it is a backdoor for adding invalid objects. * * @param buffer the buffer to predicate, must not be null * @param predicate the predicate used to evaluate new elements, must not be null * @return a predicated buffer * @throws IllegalArgumentException if the Buffer or Predicate is null */ public static Buffer predicatedBuffer(Buffer buffer, Predicate predicate) { return PredicatedBuffer.decorate(buffer, predicate); }
/** * Factory method to create a predicated (validating) buffer. * <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 predicate the predicate to use for validation, must not be null * @return a new predicated Buffer * @throws IllegalArgumentException if buffer or predicate is null * @throws IllegalArgumentException if the buffer contains invalid elements */ public static Buffer decorate(Buffer buffer, Predicate predicate) { return new PredicatedBuffer(buffer, predicate); }
public Object get() { return getBuffer().get(); }
/** * Gets the buffer being decorated. * * @return the decorated buffer */ protected Buffer getBuffer() { return (Buffer) getCollection(); }
/** * Gets the buffer being decorated. * * @return the decorated buffer */ protected Buffer getBuffer() { return (Buffer) getCollection(); }
public Object remove() { return getBuffer().remove(); }
/** * Factory method to create a predicated (validating) buffer. * <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 predicate the predicate to use for validation, must not be null * @return a new predicated Buffer * @throws IllegalArgumentException if buffer or predicate is null * @throws IllegalArgumentException if the buffer contains invalid elements */ public static Buffer decorate(Buffer buffer, Predicate predicate) { return new PredicatedBuffer(buffer, predicate); }
/** * Returns a predicated (validating) buffer backed by the given buffer. * <p> * Only objects that pass the test in the given predicate can be added to the buffer. * Trying to add an invalid object results in an IllegalArgumentException. * It is important not to use the original buffer after invoking this method, * as it is a backdoor for adding invalid objects. * * @param buffer the buffer to predicate, must not be null * @param predicate the predicate used to evaluate new elements, must not be null * @return a predicated buffer * @throws IllegalArgumentException if the Buffer or Predicate is null */ public static Buffer predicatedBuffer(Buffer buffer, Predicate predicate) { return PredicatedBuffer.decorate(buffer, predicate); }
/** * Gets the buffer being decorated. * * @return the decorated buffer */ protected Buffer getBuffer() { return (Buffer) getCollection(); }
public Object get() { return getBuffer().get(); }
/** * 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)); }
protected Buffer decorateBuffer(Buffer buffer, Predicate predicate) { return PredicatedBuffer.decorate(buffer, predicate); }
/** * Gets the buffer being decorated. * * @return the decorated buffer */ protected Buffer getBuffer() { return (Buffer) getCollection(); }
public Object remove() { return getBuffer().remove(); }
/** * 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)); }
/** * Returns a predicated (validating) buffer backed by the given buffer. * <p> * Only objects that pass the test in the given predicate can be added to the buffer. * Trying to add an invalid object results in an IllegalArgumentException. * It is important not to use the original buffer after invoking this method, * as it is a backdoor for adding invalid objects. * * @param buffer the buffer to predicate, must not be null * @param predicate the predicate used to evaluate new elements, must not be null * @return a predicated buffer * @throws IllegalArgumentException if the Buffer or Predicate is null */ public static Buffer predicatedBuffer(Buffer buffer, Predicate predicate) { return PredicatedBuffer.decorate(buffer, predicate); }
/** * Gets the buffer being decorated. * * @return the decorated buffer */ protected Buffer getBuffer() { return (Buffer) getCollection(); }
public Object remove() { return getBuffer().remove(); }
/** * Factory method to create a predicated (validating) buffer. * <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 predicate the predicate to use for validation, must not be null * @return a new predicated Buffer * @throws IllegalArgumentException if buffer or predicate is null * @throws IllegalArgumentException if the buffer contains invalid elements */ public static Buffer decorate(Buffer buffer, Predicate predicate) { return new PredicatedBuffer(buffer, predicate); }
/** * Returns a predicated (validating) buffer backed by the given buffer. * <p> * Only objects that pass the test in the given predicate can be added to the buffer. * Trying to add an invalid object results in an IllegalArgumentException. * It is important not to use the original buffer after invoking this method, * as it is a backdoor for adding invalid objects. * * @param buffer the buffer to predicate, must not be null * @param predicate the predicate used to evaluate new elements, must not be null * @return a predicated buffer * @throws IllegalArgumentException if the Buffer or Predicate is null */ public static Buffer predicatedBuffer(Buffer buffer, Predicate predicate) { return PredicatedBuffer.decorate(buffer, predicate); }