1 19 20 package org.netbeans.modules.websvc.wsitmodelext.policy; 21 22 import org.netbeans.modules.websvc.wsitmodelext.policy.impl.AllImpl; 23 import org.netbeans.modules.websvc.wsitmodelext.policy.impl.ExactlyOneImpl; 24 import org.netbeans.modules.websvc.wsitmodelext.policy.impl.PolicyImpl; 25 import org.netbeans.modules.websvc.wsitmodelext.policy.impl.PolicyReferenceImpl; 26 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 27 import org.netbeans.modules.xml.wsdl.model.spi.ElementFactory; 28 import org.w3c.dom.Element ; 29 30 import javax.xml.namespace.QName ; 31 import java.util.Collections ; 32 import java.util.Set ; 33 34 35 public class PolicyFactories { 36 37 public static class PolicyFactory extends ElementFactory { 38 @Override 39 public Set <QName > getElementQNames() { 40 return Collections.singleton(PolicyQName.POLICY.getQName()); 41 } 42 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 43 return type.cast(new PolicyImpl(context.getModel())); 44 } 45 @Override 46 public WSDLComponent create(WSDLComponent context, Element element) { 47 return new PolicyImpl(context.getModel(), element); 48 } 49 } 50 51 public static class AllFactory extends ElementFactory { 52 @Override 53 public Set <QName > getElementQNames() { 54 return Collections.singleton(PolicyQName.ALL.getQName()); 55 } 56 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 57 return type.cast(new AllImpl(context.getModel())); 58 59 } 60 @Override 61 public WSDLComponent create(WSDLComponent context, Element element) { 62 return new AllImpl(context.getModel(), element); 63 } 64 } 65 66 public static class ExactlyOneFactory extends ElementFactory { 67 @Override 68 public Set <QName > getElementQNames() { 69 return Collections.singleton(PolicyQName.EXACTLYONE.getQName()); 70 } 71 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 72 return type.cast(new ExactlyOneImpl(context.getModel())); 73 74 } 75 @Override 76 public WSDLComponent create(WSDLComponent context, Element element) { 77 return new ExactlyOneImpl(context.getModel(), element); 78 } 79 } 80 81 public static class PolicyReferenceFactory extends ElementFactory { 82 @Override 83 public Set <QName > getElementQNames() { 84 return Collections.singleton(PolicyQName.POLICYREFERENCE.getQName()); 85 } 86 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 87 return type.cast(new PolicyReferenceImpl(context.getModel())); 88 89 } 90 @Override 91 public WSDLComponent create(WSDLComponent context, Element element) { 92 return new PolicyReferenceImpl(context.getModel(), element); 93 } 94 } 95 96 } 97 | Popular Tags |