/** * Factory method that performs validation. * * @param closure1 the first closure, not null * @param closure2 the second closure, not null * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure getInstance(Closure closure1, Closure closure2) { if (closure1 == null || closure2 == null) { throw new IllegalArgumentException("Closures must not be null"); } Closure[] closures = new Closure[] { closure1, closure2 }; return new ChainedClosure(closures); }
/** * Create a new Closure that calls two Closures, passing the result of * the first into the second. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closure1 the first closure * @param closure2 the second closure * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure chainedClosure(Closure closure1, Closure closure2) { return ChainedClosure.getInstance(closure1, closure2); }
/** * Factory method that performs validation. * * @param closure1 the first closure, not null * @param closure2 the second closure, not null * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure getInstance(Closure closure1, Closure closure2) { if (closure1 == null || closure2 == null) { throw new IllegalArgumentException("Closures must not be null"); } Closure[] closures = new Closure[] { closure1, closure2 }; return new ChainedClosure(closures); }
/** * Create a new Closure that calls each closure in turn, passing the * result into the next closure. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closures an array of closures to chain * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures array is null * @throws IllegalArgumentException if any closure in the array is null */ public static Closure chainedClosure(Closure[] closures) { return ChainedClosure.getInstance(closures); }
/** * Create a new Closure that calls each closure in turn, passing the * result into the next closure. The ordering is that of the iterator() * method on the collection. * * @param closures a collection of closures to chain * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures collection is null * @throws IllegalArgumentException if any closure in the collection is null */ public static Closure getInstance(Collection closures) { if (closures == null) { throw new IllegalArgumentException("Closure collection must not be null"); } if (closures.size() == 0) { return NOPClosure.INSTANCE; } // convert to array like this to guarantee iterator() ordering Closure[] cmds = new Closure[closures.size()]; int i = 0; for (Iterator it = closures.iterator(); it.hasNext();) { cmds[i++] = (Closure) it.next(); } FunctorUtils.validate(cmds); return new ChainedClosure(cmds); }
/** * Create a new Closure that calls each closure in turn, passing the * result into the next closure. The ordering is that of the iterator() * method on the collection. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closures a collection of closures to chain * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures collection is null * @throws IllegalArgumentException if the closures collection is empty * @throws IllegalArgumentException if any closure in the collection is null */ public static Closure chainedClosure(Collection closures) { return ChainedClosure.getInstance(closures); }
/** * Create a new Closure that calls each closure in turn, passing the * result into the next closure. The ordering is that of the iterator() * method on the collection. * * @param closures a collection of closures to chain * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures collection is null * @throws IllegalArgumentException if any closure in the collection is null */ public static Closure getInstance(Collection closures) { if (closures == null) { throw new IllegalArgumentException("Closure collection must not be null"); } if (closures.size() == 0) { return NOPClosure.INSTANCE; } // convert to array like this to guarantee iterator() ordering Closure[] cmds = new Closure[closures.size()]; int i = 0; for (Iterator it = closures.iterator(); it.hasNext();) { cmds[i++] = (Closure) it.next(); } FunctorUtils.validate(cmds); return new ChainedClosure(cmds); }
/** * Create a new Closure that calls two Closures, passing the result of * the first into the second. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closure1 the first closure * @param closure2 the second closure * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure chainedClosure(Closure closure1, Closure closure2) { return ChainedClosure.getInstance(closure1, closure2); }
/** * Factory method that performs validation and copies the parameter array. * * @param closures the closures to chain, copied, no nulls * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures array is null * @throws IllegalArgumentException if any closure in the array is null */ public static Closure getInstance(Closure[] closures) { FunctorUtils.validate(closures); if (closures.length == 0) { return NOPClosure.INSTANCE; } closures = FunctorUtils.copy(closures); return new ChainedClosure(closures); }
/** * Create a new Closure that calls each closure in turn, passing the * result into the next closure. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closures an array of closures to chain * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures array is null * @throws IllegalArgumentException if any closure in the array is null */ public static Closure chainedClosure(Closure[] closures) { return ChainedClosure.getInstance(closures); }
/** * Factory method that performs validation and copies the parameter array. * * @param closures the closures to chain, copied, no nulls * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures array is null * @throws IllegalArgumentException if any closure in the array is null */ public static Closure getInstance(Closure[] closures) { FunctorUtils.validate(closures); if (closures.length == 0) { return NOPClosure.INSTANCE; } closures = FunctorUtils.copy(closures); return new ChainedClosure(closures); }
/** * Create a new Closure that calls each closure in turn, passing the * result into the next closure. The ordering is that of the iterator() * method on the collection. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closures a collection of closures to chain * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures collection is null * @throws IllegalArgumentException if the closures collection is empty * @throws IllegalArgumentException if any closure in the collection is null */ public static Closure chainedClosure(Collection closures) { return ChainedClosure.getInstance(closures); }
/** * Factory method that performs validation. * * @param closure1 the first closure, not null * @param closure2 the second closure, not null * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure getInstance(Closure closure1, Closure closure2) { if (closure1 == null || closure2 == null) { throw new IllegalArgumentException("Closures must not be null"); } Closure[] closures = new Closure[] { closure1, closure2 }; return new ChainedClosure(closures); }
/** * Create a new Closure that calls each closure in turn, passing the * result into the next closure. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closures an array of closures to chain * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures array is null * @throws IllegalArgumentException if any closure in the array is null */ public static Closure chainedClosure(Closure[] closures) { return ChainedClosure.getInstance(closures); }
/** * Factory method that performs validation. * * @param closure1 the first closure, not null * @param closure2 the second closure, not null * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure getInstance(Closure closure1, Closure closure2) { if (closure1 == null || closure2 == null) { throw new IllegalArgumentException("Closures must not be null"); } Closure[] closures = new Closure[] { closure1, closure2 }; return new ChainedClosure(closures); }
/** * Create a new Closure that calls two Closures, passing the result of * the first into the second. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closure1 the first closure * @param closure2 the second closure * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure chainedClosure(Closure closure1, Closure closure2) { return ChainedClosure.getInstance(closure1, closure2); }
/** * Factory method that performs validation. * * @param closure1 the first closure, not null * @param closure2 the second closure, not null * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure getInstance(Closure closure1, Closure closure2) { if (closure1 == null || closure2 == null) { throw new IllegalArgumentException("Closures must not be null"); } Closure[] closures = new Closure[] { closure1, closure2 }; return new ChainedClosure(closures); }
/** * Create a new Closure that calls two Closures, passing the result of * the first into the second. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closure1 the first closure * @param closure2 the second closure * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure chainedClosure(Closure closure1, Closure closure2) { return ChainedClosure.getInstance(closure1, closure2); }
/** * Factory method that performs validation. * * @param closure1 the first closure, not null * @param closure2 the second closure, not null * @return the <code>chained</code> closure * @throws IllegalArgumentException if either closure is null */ public static Closure getInstance(Closure closure1, Closure closure2) { if (closure1 == null || closure2 == null) { throw new IllegalArgumentException("Closures must not be null"); } Closure[] closures = new Closure[] { closure1, closure2 }; return new ChainedClosure(closures); }
/** * Create a new Closure that calls each closure in turn, passing the * result into the next closure. * * @see org.apache.commons.collections.functors.ChainedClosure * * @param closures an array of closures to chain * @return the <code>chained</code> closure * @throws IllegalArgumentException if the closures array is null * @throws IllegalArgumentException if any closure in the array is null */ public static Closure chainedClosure(Closure[] closures) { return ChainedClosure.getInstance(closures); }