1 package org.hibernate.mapping; 3 4 import java.io.Serializable ; 5 import java.util.ArrayList ; 6 import java.util.Collections ; 7 8 12 public class MetaAttribute implements Serializable { 13 private String name; 14 private java.util.List values = new ArrayList (); 15 16 public MetaAttribute(String name) { 17 this.name = name; 18 } 19 20 public String getName() { 21 return name; 22 } 23 24 public java.util.List getValues() { 25 return Collections.unmodifiableList(values); 26 } 27 28 public void addValue(String value) { 29 values.add(value); 30 } 31 32 public String getValue() { 33 if ( values.size()!=1 ) throw new IllegalStateException ("no unique value"); 34 return (String ) values.get(0); 35 } 36 37 public boolean isMultiValued() { 38 return values.size()>1; 39 } 40 41 public String toString() { 42 return "[" + name + "=" + values + "]"; 43 } 44 } 45 | Popular Tags |