1 22 package org.jboss.xb.binding.metadata; 23 24 import java.util.Map ; 25 import java.util.Collections ; 26 import java.util.HashMap ; 27 28 34 public class SchemaMetaData 35 { 36 private PackageMetaData packageMetaData; 37 private Map values = Collections.EMPTY_MAP; 38 private boolean ignoreUnresolvedFieldOrClass = true; 39 private boolean replacePropertyRefs = true; 40 41 public boolean isIgnoreUnresolvedFieldOrClass() 42 { 43 return ignoreUnresolvedFieldOrClass; 44 } 45 public void setIgnoreUnresolvedFieldOrClass(boolean flag) 46 { 47 this.ignoreUnresolvedFieldOrClass = flag; 48 } 49 50 public boolean isReplacePropertyRefs() 51 { 52 return replacePropertyRefs; 53 } 54 public void setReplacePropertyRefs(boolean flag) 55 { 56 this.replacePropertyRefs = flag; 57 } 58 59 public PackageMetaData getPackage() 60 { 61 return packageMetaData; 62 } 63 64 public void setPackage(PackageMetaData pkg) 65 { 66 this.packageMetaData = pkg; 67 } 68 69 public ValueMetaData getValue(String id) 70 { 71 return (ValueMetaData)values.get(id); 72 } 73 74 public void addValue(ValueMetaData value) 75 { 76 if(value.getId() == null) 77 { 78 throw new IllegalArgumentException ("ValueMetaData must have a non-null id."); 79 } 80 81 switch(values.size()) 82 { 83 case 0: 84 values = Collections.singletonMap(value.getId(), value); 85 break; 86 case 1: 87 values = new HashMap (values); 88 default: 89 values.put(value.getId(), value); 90 } 91 } 92 } 93 | Popular Tags |