1 16 package org.apache.commons.collections.functors; 17 18 import java.io.Serializable ; 19 20 import org.apache.commons.collections.Closure; 21 import org.apache.commons.collections.Transformer; 22 23 32 public class TransformerClosure implements Closure, Serializable { 33 34 35 static final long serialVersionUID = -5194992589193388969L; 36 37 38 private final Transformer iTransformer; 39 40 48 public static Closure getInstance(Transformer transformer) { 49 if (transformer == null) { 50 return NOPClosure.INSTANCE; 51 } 52 return new TransformerClosure(transformer); 53 } 54 55 61 public TransformerClosure(Transformer transformer) { 62 super(); 63 iTransformer = transformer; 64 } 65 66 71 public void execute(Object input) { 72 iTransformer.transform(input); 73 } 74 75 81 public Transformer getTransformer() { 82 return iTransformer; 83 } 84 85 } 86 | Popular Tags |