1 17 package org.apache.ws.jaxme.xs.xml.impl; 18 19 import java.util.ArrayList ; 20 import java.util.List ; 21 22 import org.apache.ws.jaxme.xs.xml.*; 23 24 25 45 public class XsGIdentityConstraintImpl implements XsGIdentityConstraint { 46 private final XsObject owner; 47 private List constraints; 48 49 protected XsGIdentityConstraintImpl(XsObject pOwner) { 50 owner = pOwner; 51 } 52 53 protected void addIdentityConstraint(XsTIdentityConstraint pConstraint) { 54 if (constraints == null) { 55 constraints = new ArrayList (); 56 } 57 constraints.add(pConstraint); 58 } 59 60 public XsEUnique createUnique() { 61 XsEUnique unique = owner.getObjectFactory().newXsEUnique(owner); 62 addIdentityConstraint(unique); 63 return unique; 64 } 65 66 public XsEKey createKey() { 67 XsEKey key = owner.getObjectFactory().newXsEKey(owner); 68 addIdentityConstraint(key); 69 return key; 70 } 71 72 public XsEKeyref createKeyref() { 73 XsEKeyref keyref = owner.getObjectFactory().newXsEKeyref(owner); 74 addIdentityConstraint(keyref); 75 return keyref; 76 } 77 78 public XsTIdentityConstraint[] getIdentityConstraints() { 79 if (constraints == null) { 80 return new XsTIdentityConstraint[0]; 81 } 82 return (XsTIdentityConstraint[]) constraints.toArray(new XsTIdentityConstraint[constraints.size()]); 83 } 84 } 85 | Popular Tags |