01: package org.andromda.cartridges.xmlschema.metafacades;
02:
03: import org.andromda.cartridges.xmlschema.XmlSchemaProfile;
04:
05: /**
06: * MetafacadeLogic implementation for org.andromda.cartridges.xmlschema.metafacades.XSDAttribute.
07: *
08: * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute
09: */
10: public class XSDAttributeLogicImpl extends XSDAttributeLogic {
11: // ---------------- constructor -------------------------------
12:
13: public XSDAttributeLogicImpl(Object metaObject, String context) {
14: super (metaObject, context);
15: }
16:
17: /**
18: * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#getMaxOccurs()
19: */
20: protected java.lang.String handleGetMaxOccurs() {
21: String maxOccurs = null;
22: boolean isMany = this .isMany();
23: if (isMany) {
24: maxOccurs = "unbounded";
25: } else {
26: maxOccurs = "1";
27: }
28: return maxOccurs;
29: }
30:
31: /**
32: * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#getMinOccurs()
33: */
34: protected java.lang.String handleGetMinOccurs() {
35: String minOccurs = null;
36: boolean isRequired = this .isRequired();
37: if (isRequired) {
38: minOccurs = "1";
39: } else {
40: minOccurs = "0";
41: }
42: return minOccurs;
43: }
44:
45: /**
46: * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isXsdAttribute()
47: */
48: protected boolean handleIsXsdAttribute() {
49: return this
50: .hasStereotype(XmlSchemaProfile.STEREOTYPE_XML_ATTRIBUTE);
51: }
52:
53: /**
54: * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isXsdElement()
55: */
56: protected boolean handleIsXsdElement() {
57: return !this .isXsdAttribute();
58: }
59:
60: /**
61: * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isOwnerSchemaType()
62: */
63: protected boolean handleIsOwnerSchemaType() {
64: final Object owner = this .getOwner();
65: return owner instanceof XSDComplexType
66: || owner instanceof XSDEnumerationType;
67: }
68:
69: }
|