/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
public Object makeObject() { return new ForClosure(10, NOPClosure.INSTANCE); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }