1 package org.hibernate.mapping; 3 4 import java.util.Map ; 5 6 import org.hibernate.MappingException; 7 import org.hibernate.type.MetaType; 8 import org.hibernate.type.AnyType; 9 import org.hibernate.type.Type; 10 import org.hibernate.type.TypeFactory; 11 12 17 public class Any extends SimpleValue { 18 19 private String identifierTypeName; 20 private String metaTypeName = "string"; 21 private Map metaValues; 22 23 public Any(Table table) { 24 super(table); 25 } 26 27 public String getIdentifierType() { 28 return identifierTypeName; 29 } 30 31 public void setIdentifierType(String identifierType) { 32 this.identifierTypeName = identifierType; 33 } 34 35 public Type getType() throws MappingException { 36 return new AnyType( 37 metaValues==null ? 38 TypeFactory.heuristicType(metaTypeName) : 39 new MetaType( metaValues, TypeFactory.heuristicType(metaTypeName) ), 40 TypeFactory.heuristicType(identifierTypeName) 41 ); 42 } 43 44 public void setTypeByReflection(String propertyClass, String propertyName) {} 45 46 public String getMetaType() { 47 return metaTypeName; 48 } 49 50 public void setMetaType(String type) { 51 metaTypeName = type; 52 } 53 54 public Map getMetaValues() { 55 return metaValues; 56 } 57 58 public void setMetaValues(Map metaValues) { 59 this.metaValues = metaValues; 60 } 61 62 public void setTypeUsingReflection(String className, String propertyName) 63 throws MappingException { 64 } 65 66 public Object accept(ValueVisitor visitor) { 67 return visitor.accept(this); 68 } 69 } 70 | Popular Tags |