1 2 package simple; 3 4 import java.util.ArrayList ; 5 6 import org.jibx.runtime.IUnmarshallingContext; 7 8 public class MyClass5 { 9 private ArrayList childs; 10 11 private void unmarshalDone() { 12 for (int i = 0; i < childs.size(); i++) { 13 ((MyClass5a)childs.get(i)).verify(); 14 } 15 } 16 17 private static MyClass5b bFactory() { 18 MyClass5b inst = new MyClass5b(); 19 inst.factory = true; 20 return inst; 21 } 22 23 private static MyClass5c cFactory(Object obj) { 24 if (!(obj instanceof ArrayList )) { 25 throw new IllegalStateException ("factory called with wrong object"); 26 } 27 MyClass5c inst = new MyClass5c(); 28 inst.factory = true; 29 return inst; 30 } 31 32 private static MyClass5d dFactory(IUnmarshallingContext ctx) { 33 if (!(ctx.getStackObject(1) instanceof MyClass5)) { 34 throw new IllegalStateException ("wrong object in stack"); 35 } 36 MyClass5d inst = new MyClass5d(); 37 inst.factory = true; 38 return inst; 39 } 40 } 41 | Popular Tags |