1 22 package org.jboss.metadata.spi.retrieval.simple; 23 24 import org.jboss.metadata.spi.MetaData; 25 import org.jboss.metadata.spi.retrieval.MetaDataItem; 26 import org.jboss.metadata.spi.retrieval.MetaDatasItem; 27 28 34 public class SimpleMetaDatasItem extends SimpleItem<Object []> implements MetaDatasItem 35 { 36 37 public static final SimpleMetaDatasItem NO_META_DATA = new SimpleMetaDatasItem(); 38 39 40 private MetaDataItem[] metaDataItems; 41 42 43 private Object [] metaDatas; 44 45 48 protected SimpleMetaDatasItem() 49 { 50 this(NO_META_DATA_ITEMS); 51 } 52 53 58 public SimpleMetaDatasItem(MetaDataItem[] metaDataItems) 59 { 60 setMetaDataItems(metaDataItems); 61 } 62 63 public Object [] getValue() 64 { 65 if (metaDatas == null) 66 { 67 Object [] temp = new Object [metaDataItems.length]; 68 for (int i = 0; i < temp.length; ++i) 69 temp[i] = metaDataItems[i].getValue(); 70 metaDatas = temp; 71 } 72 return metaDatas; 73 } 74 75 public MetaDataItem[] getMetaDatas() 76 { 77 return metaDataItems; 78 } 79 80 85 protected void setMetaDataItems(MetaDataItem[] metaDataItems) 86 { 87 if (metaDataItems == null) 88 throw new IllegalArgumentException ("Null metaDataItems"); 89 90 this.metaDataItems = metaDataItems; 91 if (metaDataItems.length == 0) 92 metaDatas = MetaData.NO_METADATA; 93 else 94 metaDatas = null; 95 } 96 } 97 | Popular Tags |