1 28 29 package org.jibx.binding.model; 30 31 import java.util.ArrayList ; 32 33 import org.jibx.binding.util.StringArray; 34 import org.jibx.runtime.IUnmarshallingContext; 35 import org.jibx.runtime.JiBXException; 36 37 43 44 public class MappingElement extends TemplateElementBase 45 { 46 47 public static final StringArray s_allowedAttributes = 48 new StringArray(new String [] { "abstract", "class", "extends" }, 49 new StringArray(NameAttributes.s_allowedAttributes, 50 ContainerElementBase.s_allowedAttributes)); 51 53 54 private boolean m_isAbstract; 55 56 57 private NameAttributes m_nameAttrs; 58 59 60 private String m_extendsName; 61 62 63 private MappingElement m_extendsMapping; 64 65 68 public MappingElement() { 69 super(MAPPING_ELEMENT); 70 m_nameAttrs = new NameAttributes(); 71 m_children = new ArrayList (); 72 } 73 74 79 public boolean isAbstract() { 80 return m_isAbstract; 81 } 82 83 88 public void setAbstract(boolean abs) { 89 m_isAbstract = abs; 90 } 91 92 97 public void setExtendsName(String name) { 98 m_extendsName = name; 99 } 100 101 106 public String getExtendsName() { 107 return m_extendsName; 108 } 109 110 115 public MappingElement getExtendsMapping() { 116 return m_extendsMapping; 117 } 118 119 122 public boolean isDefaultTemplate() { 123 return true; 125 } 126 127 130 135 public String getName() { 136 return m_nameAttrs.getName(); 137 } 138 139 144 public void setName(String name) { 145 m_nameAttrs.setName(name); 146 } 147 148 153 public String getUri() { 154 return m_nameAttrs.getUri(); 155 } 156 157 162 public void setUri(String uri) { 163 m_nameAttrs.setUri(uri); 164 } 165 166 171 public String getPrefix() { 172 return m_nameAttrs.getPrefix(); 173 } 174 175 180 public void setPrefix(String prefix) { 181 m_nameAttrs.setPrefix(prefix); 182 } 183 184 190 public NamespaceElement getNamespace() { 191 return m_nameAttrs.getNamespace(); 192 } 193 194 197 203 private void preSet(IUnmarshallingContext uctx) throws JiBXException { 204 validateAttributes(uctx, s_allowedAttributes); 205 } 206 207 210 public void prevalidate(ValidationContext vctx) { 211 m_nameAttrs.prevalidate(vctx); 212 super.prevalidate(vctx); 213 } 214 215 218 public void validate(ValidationContext vctx) { 219 m_nameAttrs.validate(vctx); 220 super.validate(vctx); 221 } 222 } | Popular Tags |