1 25 26 27 package org.objectweb.jonas_ejb.genic; 28 29 import org.objectweb.jonas_ejb.lib.JavaType; 30 31 36 public class VcParamWhere { 37 38 41 private String mName; 42 43 46 private String mTypeName; 47 48 51 private String mSqlTypeName; 52 53 56 private String mSqlSetMethod; 57 58 61 private boolean hasNotPrimitiveType; 62 63 66 private boolean hasBigIntegerType; 67 68 71 private boolean hasSerializableType; 72 73 76 private boolean hasJavaLangTypeExceptString; 77 78 83 VcParamWhere(Class type, int position) { 84 85 mName = new String ("p" + position); 86 mTypeName = JavaType.getName(type); 87 mSqlTypeName = JavaType.getSQLType(type); 88 mSqlSetMethod = JavaType.getSQLSetMethod(type); 89 if (mSqlSetMethod == null) { 90 throw new Error ("Cannot container persistence manage the type '" 91 + type.getName() + "'"); 92 } 93 hasNotPrimitiveType = !type.isPrimitive(); 94 hasBigIntegerType = type.equals(java.math.BigInteger .class); 95 hasSerializableType = "setSerializable".equals(mSqlSetMethod); 96 hasJavaLangTypeExceptString = false; 97 if (type.getPackage() != null) { 98 if ("java.lang".equals(type.getPackage().getName()) 99 && !java.lang.String .class.equals(type)) { 100 hasJavaLangTypeExceptString = true; 101 } 102 } 103 104 } 107 108 111 public String getName() { 112 return mName; 113 } 114 115 118 public String getTypeName() { 119 return mTypeName; 120 } 121 122 125 public String getSqlTypeName() { 126 return mSqlTypeName; 127 } 128 129 132 public String getSqlSetMethod() { 133 return mSqlSetMethod; 134 } 135 136 139 public boolean hasNotPrimitiveType() { 140 return hasNotPrimitiveType; 141 } 142 143 146 public boolean hasBigIntegerType() { 147 return hasBigIntegerType; 148 } 149 150 153 public boolean hasSerializableType() { 154 return hasSerializableType; 155 } 156 157 160 public boolean hasJavaLangTypeExceptString() { 161 return hasJavaLangTypeExceptString; 162 } 163 164 167 public String toString() { 168 StringBuffer ret = new StringBuffer (); 169 ret.append("\n Name = " + getName()); 170 ret.append("\n TypeName = " + getTypeName()); 171 ret.append("\n SqlTypeName = " + getSqlTypeName()); 172 ret.append("\n SqlSetMethod = " + getSqlSetMethod()); 173 ret.append("\n hasNotPrimitiveType = " + hasNotPrimitiveType()); 174 ret.append("\n hasBigIntegerType = " + hasBigIntegerType()); 175 ret.append("\n hasSerializableType = " + hasSerializableType()); 176 ret.append("\n hasJavaLangTypeExceptString = " + hasJavaLangTypeExceptString()); 177 return (ret.toString()); 178 } 179 180 } 181 | Popular Tags |