1 package spoon.reflect.factory; 2 3 import java.io.Serializable ; 4 import java.util.Collection ; 5 6 import spoon.reflect.Factory; 7 import spoon.reflect.declaration.CtElement; 8 9 13 public abstract class SubFactory implements Serializable { 14 15 private static final long serialVersionUID = 1L; 16 17 Factory factory; 18 19 22 public SubFactory(Factory factory) { 23 super(); 24 this.factory = factory; 25 } 26 27 30 public void setFactory(Factory factory) { 31 this.factory = factory; 32 } 33 34 42 protected void setParent(CtElement parent, Object ... elements) { 43 for (Object o : elements) { 44 if (o instanceof CtElement) { 45 ((CtElement) o).setParent(parent); 46 } else if (o instanceof Collection ) { 47 for (Object o2 : (Collection ) o) { 48 ((CtElement) o2).setParent(parent); 49 } 50 } 51 } 52 } 53 54 } 55 | Popular Tags |