1 22 package org.jboss.ejb.plugins.cmp.ejbql; 23 24 import java.util.Date ; 25 import javax.ejb.EJBLocalObject ; 26 import javax.ejb.EJBObject ; 27 28 35 public final class EJBQLTypes 36 { 37 public static final int UNKNOWN_TYPE = -1; 38 public static final int NUMERIC_TYPE = 1; 39 public static final int STRING_TYPE = 2; 40 public static final int DATETIME_TYPE = 3; 41 public static final int BOOLEAN_TYPE = 4; 42 public static final int ENTITY_TYPE = 5; 43 public static final int VALUE_CLASS_TYPE = 6; 44 45 public static int getEJBQLType(Class type) 46 { 47 int result; 48 if(type == Boolean .class || type == Boolean.TYPE) 49 { 50 result = BOOLEAN_TYPE; 51 } 52 else if(type.isPrimitive() 53 || type == Character .class 54 || Number .class.isAssignableFrom(type)) 55 { 56 result = NUMERIC_TYPE; 57 } 58 else if(type == String .class) 59 { 60 result = STRING_TYPE; 61 } 62 else if(Date .class.isAssignableFrom(type)) 63 { 64 result = DATETIME_TYPE; 65 } 66 else if(EJBObject .class.isAssignableFrom(type) || 67 EJBLocalObject .class.isAssignableFrom(type)) 68 { 69 result = ENTITY_TYPE; 70 } 71 else 72 { 73 result = VALUE_CLASS_TYPE; 74 } 75 return result; 76 } 77 } 78 | Popular Tags |