if (a[i].startsWith("a")) { String fieldName = a[i].substring(1).intern(); Class<?> fieldClass = fieldInfos.get(fieldName).getType(); String firstString = (i + 1 == a.length ? "" : a[i + 1]); StringBuffer string = null; if (a[i].startsWith("a")) { String fieldName = a[i].substring(1); Class<?> fieldClass = fieldInfos.get(fieldName).getType(); String firstString = (i + 1 == a.length ? "" : a[i + 1]); StringBuffer string = null;
if (a[i].startsWith("a")) { String fieldName = a[i].substring(1).intern(); Class<?> fieldClass = fieldInfos.get(fieldName).getType(); String firstString = (i + 1 == a.length ? "" : a[i + 1]); StringBuffer string = null; if (a[i].startsWith("a")) { String fieldName = a[i].substring(1); Class<?> fieldClass = fieldInfos.get(fieldName).getType(); String firstString = (i + 1 == a.length ? "" : a[i + 1]); StringBuffer string = null;
String fieldName = entry.getKey(); TypeUtil.FieldInfo fieldInfo = entry.getValue(); if (!Collection.class.isAssignableFrom(fieldInfo.getType())) { validFieldNames.add(fieldName);
String fieldName = entry.getKey(); TypeUtil.FieldInfo fieldInfo = entry.getValue(); if (!Collection.class.isAssignableFrom(fieldInfo.getType())) { validFieldNames.add(fieldName);
for (FieldDescriptor field : fields) { String fieldName = field.getName(); Class<?> fieldType = fieldInfos.get(fieldName).getType(); if (InterMineObject.class.isAssignableFrom(fieldType)) { String fieldAlias = DatabaseUtil.getColumnName(field).toLowerCase();
throw new MetaDataException(message); Class<?> attrClass = info.getType(); if (!"id".equalsIgnoreCase(attr.getName())) { Object value = null;
for (FieldDescriptor field : fields) { String fieldName = field.getName(); Class<?> fieldType = fieldInfos.get(fieldName).getType(); if (InterMineObject.class.isAssignableFrom(fieldType)) { String fieldAlias = DatabaseUtil.getColumnName(field).toLowerCase();
throw new MetaDataException(message); Class<?> attrClass = info.getType(); if (!"id".equalsIgnoreCase(attr.getName())) { Object value = null;
: TypeUtil.getFieldInfos(o.getClass()).entrySet()) { TypeUtil.FieldInfo fieldInfo = fieldEntry.getValue(); if (InterMineObject.class.isAssignableFrom(fieldInfo.getType())) { InterMineObject obj = (InterMineObject) TypeUtil.getFieldProxy(o, fieldInfo.getName()); obj.setId(getSerialWithConnection(c)); } else if (Collection.class.isAssignableFrom(fieldInfo.getType())) { @SuppressWarnings("unchecked") Collection<Object> coll = (Collection<Object>) o.getFieldValue(fieldInfo.getName());
: TypeUtil.getFieldInfos(o.getClass()).entrySet()) { TypeUtil.FieldInfo fieldInfo = fieldEntry.getValue(); if (InterMineObject.class.isAssignableFrom(fieldInfo.getType())) { InterMineObject obj = (InterMineObject) TypeUtil.getFieldProxy(o, fieldInfo.getName()); obj.setId(getSerialWithConnection(c)); } else if (Collection.class.isAssignableFrom(fieldInfo.getType())) { @SuppressWarnings("unchecked") Collection<Object> coll = (Collection<Object>) o.getFieldValue(fieldInfo.getName());
/** * Writes the contents of any pending Clobs to the database, and replaces them in the objects * with a real ClobAccess object. * * @param c a connection * @param o the object to transform * @throws ObjectStoreException if something goes wrong * @throws SQLException if something goes wrong * @throws IllegalAccessException if something goes wrong */ protected void writePendingClobs(Connection c, Object o) throws ObjectStoreException, SQLException, IllegalAccessException { for (Map.Entry<String, TypeUtil.FieldInfo> fieldEntry : TypeUtil.getFieldInfos(o.getClass()).entrySet()) { TypeUtil.FieldInfo fieldInfo = fieldEntry.getValue(); if (ClobAccess.class.isAssignableFrom(fieldInfo.getType())) { ClobAccess ca = (ClobAccess) TypeUtil.getFieldValue(o, fieldInfo.getName()); if (ca instanceof PendingClob) { // We can't call createClob here - we already have a connection, and // we must use that one. Clob clob = new Clob(getSerialWithConnection(c)); replaceClobWithConnection(c, clob, ((PendingClob) ca) .toString()); DynamicUtil.setFieldValue(o, fieldInfo.getName(), new ClobAccess(this, clob)); } } } }
/** * Writes the contents of any pending Clobs to the database, and replaces them in the objects * with a real ClobAccess object. * * @param c a connection * @param o the object to transform * @throws ObjectStoreException if something goes wrong * @throws SQLException if something goes wrong * @throws IllegalAccessException if something goes wrong */ protected void writePendingClobs(Connection c, Object o) throws ObjectStoreException, SQLException, IllegalAccessException { for (Map.Entry<String, TypeUtil.FieldInfo> fieldEntry : TypeUtil.getFieldInfos(o.getClass()).entrySet()) { TypeUtil.FieldInfo fieldInfo = fieldEntry.getValue(); if (ClobAccess.class.isAssignableFrom(fieldInfo.getType())) { ClobAccess ca = (ClobAccess) TypeUtil.getFieldValue(o, fieldInfo.getName()); if (ca instanceof PendingClob) { // We can't call createClob here - we already have a connection, and // we must use that one. Clob clob = new Clob(getSerialWithConnection(c)); replaceClobWithConnection(c, clob, ((PendingClob) ca) .toString()); DynamicUtil.setFieldValue(o, fieldInfo.getName(), new ClobAccess(this, clob)); } } } }
/** * Returns the type of a field given the field name. * * @param c the Class * @param fieldName the name of the relevant field * @return the class of the field, or null if the field is not found */ public static Class<?> getFieldType(Class<?> c, String fieldName) { FieldInfo info = getFieldInfo(c, fieldName); if (info != null) { return info.getType(); } return null; }
/** * Returns the type of a field given the field name. * * @param c the Class * @param fieldName the name of the relevant field * @return the class of the field, or null if the field is not found */ public static Class<?> getFieldType(Class<?> c, String fieldName) { FieldInfo info = getFieldInfo(c, fieldName); if (info != null) { return info.getType(); } return null; }