1 22 package org.jboss.metadata.spi.retrieval.basic; 23 24 import org.jboss.metadata.spi.MetaData; 25 import org.jboss.metadata.spi.loader.MetaDataLoader; 26 import org.jboss.metadata.spi.retrieval.MetaDataItem; 27 import org.jboss.metadata.spi.retrieval.MetaDatasItem; 28 29 35 public class BasicMetaDatasItem extends BasicItem<Object []> implements MetaDatasItem 36 { 37 38 private MetaDataItem[] metaDataItems; 39 40 41 private Object [] metaDatas; 42 43 49 public BasicMetaDatasItem(MetaDataLoader loader, MetaDataItem[] metaDataItems) 50 { 51 super(loader); 52 53 if (metaDataItems == null) 54 throw new IllegalArgumentException ("Null metaDataItems"); 55 56 this.metaDataItems = metaDataItems; 57 58 if (metaDataItems.length == 0) 59 metaDatas = MetaData.NO_METADATA; 60 } 61 62 public Object [] getValue() 63 { 64 if (metaDatas == null) 65 { 66 Object [] temp = new Object [metaDataItems.length]; 67 for (int i = 0; i < temp.length; ++i) 68 temp[i] = metaDataItems[i].getValue(); 69 metaDatas = temp; 70 } 71 return metaDatas; 72 } 73 74 public MetaDataItem[] getMetaDatas() 75 { 76 return metaDataItems; 77 } 78 79 public boolean isCachable() 80 { 81 if (super.isCachable() == false) 82 return false; 83 84 for (MetaDataItem item : metaDataItems) 85 { 86 if (item.isCachable() == false) 87 return false; 88 } 89 90 return true; 91 } 92 93 public boolean isValid() 94 { 95 if (super.isValid() == false) 96 return false; 97 98 for (MetaDataItem item : metaDataItems) 99 { 100 if (item.isValid() == false) 101 return false; 102 } 103 104 return true; 105 } 106 } 107 | Popular Tags |