00001
00027 package org.objectweb.jonas_ejb.genic;
00028
00029 import org.objectweb.jonas_ejb.lib.JavaType;
00030
00036 public class VcParamWhere {
00037
00041 private String mName;
00042
00046 private String mTypeName;
00047
00051 private String mSqlTypeName;
00052
00056 private String mSqlSetMethod;
00057
00061 private boolean hasNotPrimitiveType;
00062
00066 private boolean hasBigIntegerType;
00067
00071 private boolean hasSerializableType;
00072
00076 private boolean hasJavaLangTypeExceptString;
00077
00083 VcParamWhere(Class type, int position) {
00084
00085 mName = new String("p" + position);
00086 mTypeName = JavaType.getName(type);
00087 mSqlTypeName = JavaType.getSQLType(type);
00088 mSqlSetMethod = JavaType.getSQLSetMethod(type);
00089 if (mSqlSetMethod == null) {
00090 throw new Error("Cannot container persistence manage the type '"
00091 + type.getName() + "'");
00092 }
00093 hasNotPrimitiveType = !type.isPrimitive();
00094 hasBigIntegerType = type.equals(java.math.BigInteger.class);
00095 hasSerializableType = "setSerializable".equals(mSqlSetMethod);
00096 hasJavaLangTypeExceptString = false;
00097 if (type.getPackage() != null) {
00098 if ("java.lang".equals(type.getPackage().getName())
00099 && !java.lang.String.class.equals(type)) {
00100 hasJavaLangTypeExceptString = true;
00101 }
00102 }
00103
00104
00105
00106 }
00107
00111 public String getName() {
00112 return mName;
00113 }
00114
00118 public String getTypeName() {
00119 return mTypeName;
00120 }
00121
00125 public String getSqlTypeName() {
00126 return mSqlTypeName;
00127 }
00128
00132 public String getSqlSetMethod() {
00133 return mSqlSetMethod;
00134 }
00135
00139 public boolean hasNotPrimitiveType() {
00140 return hasNotPrimitiveType;
00141 }
00142
00146 public boolean hasBigIntegerType() {
00147 return hasBigIntegerType;
00148 }
00149
00153 public boolean hasSerializableType() {
00154 return hasSerializableType;
00155 }
00156
00160 public boolean hasJavaLangTypeExceptString() {
00161 return hasJavaLangTypeExceptString;
00162 }
00163
00167 public String toString() {
00168 StringBuffer ret = new StringBuffer();
00169 ret.append("\n Name = " + getName());
00170 ret.append("\n TypeName = " + getTypeName());
00171 ret.append("\n SqlTypeName = " + getSqlTypeName());
00172 ret.append("\n SqlSetMethod = " + getSqlSetMethod());
00173 ret.append("\n hasNotPrimitiveType = " + hasNotPrimitiveType());
00174 ret.append("\n hasBigIntegerType = " + hasBigIntegerType());
00175 ret.append("\n hasSerializableType = " + hasSerializableType());
00176 ret.append("\n hasJavaLangTypeExceptString = " + hasJavaLangTypeExceptString());
00177 return (ret.toString());
00178 }
00179
00180 }