1 13 package com.tonbeller.jpivot.olap.model.impl; 14 15 import java.util.List ; 16 17 import com.tonbeller.jpivot.olap.model.Property; 18 import com.tonbeller.jpivot.olap.model.PropertyHolder; 19 20 25 public class PropertyHolderImpl implements PropertyHolder { 26 private static final Property[] EMPTY = new Property[0]; 27 Property[] properties; 28 29 public PropertyHolderImpl() { 30 this.properties = EMPTY; 31 } 32 33 public PropertyHolderImpl(Property[] properties) { 34 this.properties = properties; 35 } 36 37 public PropertyHolderImpl(List propertyList) { 38 this.properties = (Property[]) propertyList.toArray(new Property[propertyList.size()]); 39 } 40 41 45 public Property[] getProperties() { 46 return properties; 47 } 48 49 50 54 public void setProperties(Property[] properties) { 55 this.properties = properties; 56 } 57 58 59 62 public Property getProperty(String name) { 63 for (int i = 0; i < properties.length; i++) 64 if (name.equals(properties[i].getName())) 65 return properties[i]; 66 return null; 67 } 68 69 72 public void addProperty(PropertyImpl property) { 73 int N = properties.length; 74 Property[] old = properties; 75 properties = new Property[N + 1]; 76 System.arraycopy(old, 0, properties, 0, N); 77 properties[N] = property; 78 } 79 80 } 81 | Popular Tags |