List of usage examples for java.lang.reflect Modifier isTransient
public static boolean isTransient(int mod)
From source file:org.red5.io.amf.Output.java
/** * Writes an arbitrary object to the output. * * @param serializer Output writer/*from w w w . ja va 2 s . c om*/ * @param object Object to write */ protected void writeArbitraryObject(Object object, Serializer serializer) { if (log.isDebugEnabled()) { log.debug("writeObject"); } // If we need to serialize class information... Class<?> objectClass = object.getClass(); if (!objectClass.isAnnotationPresent(Anonymous.class)) { // Write out start object marker for class name buf.put(AMF.TYPE_CLASS_OBJECT); putString(buf, objectClass.getName()); } else { // Write out start object marker without class name buf.put(AMF.TYPE_OBJECT); } // Get public field values Map<String, Object> values = new HashMap<String, Object>(); // Iterate thru fields of an object to build "name-value" map from it for (Field field : objectClass.getFields()) { if (field.isAnnotationPresent(DontSerialize.class)) { if (log.isDebugEnabled()) { log.debug("Skipping " + field.getName() + " because its marked with @DontSerialize"); } continue; } else { int modifiers = field.getModifiers(); if (Modifier.isTransient(modifiers)) { log.warn("Using \"transient\" to declare fields not to be serialized is " + "deprecated and will be removed in Red5 0.8, use \"@DontSerialize\" instead."); continue; } } Object value; try { // Get field value value = field.get(object); } catch (IllegalAccessException err) { // Swallow on private and protected properties access exception continue; } // Put field to the map of "name-value" pairs values.put(field.getName(), value); } // Output public values Iterator<Map.Entry<String, Object>> it = values.entrySet().iterator(); // Iterate thru map and write out properties with separators while (it.hasNext()) { Map.Entry<String, Object> entry = it.next(); // Write out prop name putString(buf, entry.getKey()); // Write out serializer.serialize(this, entry.getValue()); } // Write out end of object marker buf.put((byte) 0x00); buf.put((byte) 0x00); buf.put(AMF.TYPE_END_OF_OBJECT); }
From source file:cern.c2mon.shared.common.datatag.address.impl.HardwareAddressImpl.java
/** * The two addresses are considered equals if they're of the same type and all their non-static attributes are equal *//* w w w .ja va 2 s .c om*/ @Override public final boolean equals(final Object copy) { boolean result = copy != null && copy instanceof HardwareAddress && this.getClass().equals(copy.getClass()); if (result) { Field[] fields = this.getClass().getDeclaredFields(); for (Field field : fields) { if (!Modifier.isFinal(field.getModifiers()) && !Modifier.isStatic(field.getModifiers()) && !Modifier.isTransient(field.getModifiers())) { try { if ((field.get(this) != null && field.get(copy) == null) || (field.get(this) == null && field.get(copy) != null)) { result = false; } else if (field.get(this) != null && field.get(copy) != null) { if (field.getType().isArray()) { if (Object[].class.isAssignableFrom(field.getType())) { result = Arrays.equals((Object[]) field.get(this), (Object[]) field.get(copy)); } else { result = ArrayUtils.isEquals(field.get(this), field.get(copy)); } } else { result = field.get(this).equals(field.get(copy)); } } } catch (Exception e) { result = false; } } if (!result) { break; } } } return result; }
From source file:net.dmulloy2.ultimatearena.types.ArenaConfig.java
@Override public Map<String, Object> serialize() { Map<String, Object> data = new LinkedHashMap<>(); for (Field field : ArenaConfig.class.getDeclaredFields()) { try {//from w w w . j a v a2 s . c o m if (Modifier.isTransient(field.getModifiers())) continue; boolean accessible = field.isAccessible(); field.setAccessible(true); if (field.getType().equals(Integer.TYPE)) { if (field.getInt(this) != 0) data.put(field.getName(), field.getInt(this)); } else if (field.getType().equals(Long.TYPE)) { if (field.getLong(this) != 0) data.put(field.getName(), field.getLong(this)); } else if (field.getType().equals(Boolean.TYPE)) { if (field.getBoolean(this)) data.put(field.getName(), field.getBoolean(this)); } else if (field.getType().isAssignableFrom(Collection.class)) { if (!((Collection<?>) field.get(this)).isEmpty()) data.put(field.getName(), field.get(this)); } else if (field.getType().isAssignableFrom(String.class)) { if ((String) field.get(this) != null) data.put(field.getName(), field.get(this)); } else if (field.getType().isAssignableFrom(Map.class)) { if (!((Map<?, ?>) field.get(this)).isEmpty()) data.put(field.getName(), field.get(this)); } else { if (field.get(this) != null) data.put(field.getName(), field.get(this)); } field.setAccessible(accessible); } catch (Throwable ex) { } } serializeCustomOptions(data); return data; }
From source file:com.judoscript.jamaica.parser.JamaicaDumpVisitor.java
static void printAccessFlags(int flags) { if (Modifier.isPublic(flags)) out.print("public "); else if (Modifier.isProtected(flags)) out.print("protected "); else if (Modifier.isPrivate(flags)) out.print("private "); if (Modifier.isAbstract(flags)) out.print("abstract "); if (Modifier.isFinal(flags)) out.print("final "); if (Modifier.isNative(flags)) out.print("native "); if (Modifier.isStatic(flags)) out.print("static "); if (Modifier.isStrict(flags)) out.print("strict "); if (Modifier.isSynchronized(flags)) out.print("synchronized "); if (Modifier.isTransient(flags)) out.print("transient "); if (Modifier.isVolatile(flags)) out.print("volative "); }
From source file:net.dmulloy2.ultimatearena.types.ArenaZone.java
/** * {@inheritDoc}/* w ww .ja v a 2s . c om*/ */ @Override public Map<String, Object> serialize() { Map<String, Object> data = new LinkedHashMap<>(); for (java.lang.reflect.Field field : ArenaZone.class.getDeclaredFields()) { if (Modifier.isTransient(field.getModifiers())) continue; try { boolean accessible = field.isAccessible(); field.setAccessible(true); if (field.getType().equals(Integer.TYPE)) { if (field.getInt(this) != 0) data.put(field.getName(), field.getInt(this)); } else if (field.getType().equals(Long.TYPE)) { if (field.getLong(this) != 0) data.put(field.getName(), field.getLong(this)); } else if (field.getType().equals(Boolean.TYPE)) { if (field.getBoolean(this)) data.put(field.getName(), field.getBoolean(this)); } else if (field.getType().isAssignableFrom(Collection.class)) { if (!((Collection<?>) field.get(this)).isEmpty()) data.put(field.getName(), field.get(this)); } else if (field.getType().isAssignableFrom(String.class)) { if ((String) field.get(this) != null) data.put(field.getName(), field.get(this)); } else if (field.getType().isAssignableFrom(Map.class)) { if (!((Map<?, ?>) field.get(this)).isEmpty()) data.put(field.getName(), field.get(this)); } else { if (field.get(this) != null) data.put(field.getName(), field.get(this)); } field.setAccessible(accessible); } catch (Throwable ex) { } } data.put("version", CURRENT_VERSION); return data; }
From source file:cern.c2mon.shared.common.datatag.address.impl.HardwareAddressImpl.java
@Override public final int hashCode() { int result = 0; Field[] fields = this.getClass().getDeclaredFields(); for (Field field : fields) { // compare non-final, non-static and non-transient fields only if (!Modifier.isFinal(field.getModifiers()) && !Modifier.isStatic(field.getModifiers()) && !Modifier.isTransient(field.getModifiers())) { try { // skip arrays if (!field.getType().isArray() && field.get(this) != null) { // for string take its length if (field.getType().equals(String.class)) { result ^= ((String) field.get(this)).length(); } else if (field.getType().equals(short.class) || field.getType().equals(Short.class)) { result ^= field.getShort(this); } else if (field.getType().equals(int.class) || field.getType().equals(Integer.class)) { result ^= field.getInt(this); } else if (field.getType().equals(float.class) || field.getType().equals(Float.class)) { result ^= (int) field.getFloat(this); } else if (field.getType().equals(double.class) || field.getType().equals(Double.class)) { result ^= (int) field.getDouble(this); } else if (field.getType().equals(long.class) || field.getType().equals(Long.class)) { result ^= (int) field.getLong(this); } else if (field.getType().equals(byte.class) || field.getType().equals(Byte.class)) { result ^= field.getByte(this); } else if (field.getType().equals(boolean.class) || field.getType().equals(Boolean.class)) { result ^= field.getBoolean(this) == Boolean.TRUE ? 1 : 0; }//from w ww. ja v a 2 s .co m } } catch (Exception e) { log.error(e.toString()); throw new RuntimeException("Exception caught while calculating HardwareAddress hashcode.", e); } } } return result; }
From source file:org.projectforge.core.AbstractBaseDO.java
/** * Returns whether or not to append the given <code>Field</code>. * <ul>//ww w . j a v a 2 s . c o m * <li>Ignore transient fields * <li>Ignore static fields * <li>Ignore inner class fields</li> * </ul> * * @param field The Field to test. * @return Whether or not to consider the given <code>Field</code>. */ protected static boolean accept(final Field field) { if (field.getName().indexOf(ClassUtils.INNER_CLASS_SEPARATOR_CHAR) != -1) { // Reject field from inner class. return false; } if (Modifier.isTransient(field.getModifiers()) == true) { // transients. return false; } if (Modifier.isStatic(field.getModifiers()) == true) { // transients. return false; } if ("created".equals(field.getName()) == true || "lastUpdate".equals(field.getName()) == true) { return false; } return true; }
From source file:org.vulpe.model.dao.impl.jpa.VulpeBaseDAOJPA.java
private void mountOrder(final ENTITY entity, final StringBuilder order) { final List<Field> fields = VulpeReflectUtil.getFields(entity.getClass()); for (final Field field : fields) { if ((field.isAnnotationPresent(SkipAutoFilter.class) || field.isAnnotationPresent(Transient.class) || Modifier.isTransient(field.getModifiers())) && !field.isAnnotationPresent(QueryParameter.class)) { continue; }//from w ww.java 2s. c o m final OrderBy orderBy = field.getAnnotation(OrderBy.class); if (orderBy != null) { if (StringUtils.isNotBlank(order.toString())) { order.append(","); } order.append("obj.").append(field.getName()).append(" ").append(orderBy.type().name()); } } }
From source file:org.vulpe.model.dao.impl.db4o.VulpeBaseDAODB4O.java
/** * * @param entity/* ww w .j a v a 2 s. c o m*/ * @return */ public Query getQuery(final ENTITY entity) { final Query query = getObjectContainer().query(); query.constrain(entity.getClass()); final Map<String, String> orderMap = new HashedMap(); if (StringUtils.isNotBlank(entity.getOrderBy())) { final String[] orderArray = entity.getOrderBy().split(","); for (int i = 0; i < orderArray.length; i++) { String order = orderArray[i].trim(); boolean descending = false; if (order.contains("desc")) { descending = true; order = order.replaceAll(" desc", ""); } else { order = order.replaceAll(" asc", ""); } final String[] orderParts = order.split("\\."); Query subQuery = query; int count = 1; for (String orderPart : orderParts) { orderMap.put(orderPart, orderPart); if (count == orderParts.length) { if (descending) { subQuery.descend(orderPart).orderDescending(); } else { subQuery.descend(orderPart).orderAscending(); } } else { subQuery = subQuery.descend(orderPart); } } } } emptyToNull(entity); for (Field field : VulpeReflectUtil.getFields(getEntityClass())) { if (field.isAnnotationPresent(SkipAutoFilter.class)) { continue; } final Object value = VulpeReflectUtil.getFieldValue(entity, field.getName()); if (VulpeLogicEntity.class.isAssignableFrom(entity.getClass()) && field.getName().equals(DB4O.STATUS)) { query.descend(field.getName()).constrain(Status.D).not(); } final OrderBy orderBy = field.getAnnotation(OrderBy.class); if (orderBy != null && !orderMap.containsKey(field.getName())) { if (orderBy.type().equals(OrderType.DESC)) { query.descend(field.getName()).orderDescending(); } else { query.descend(field.getName()).orderAscending(); } } if (value != null) { final QueryParameter queryParameter = field.getAnnotation(QueryParameter.class); if (queryParameter != null) { String paramName = queryParameter.equals().name(); if (StringUtils.isBlank(paramName)) { paramName = field.getName(); } final String[] relations = paramName.split("\\."); if (relations != null && relations.length > 1) { int count = 1; Query subQuery = query; for (String relation : relations) { if (count == relations.length) { subQuery.descend(relation).constrain(value).equal(); } else { subQuery = subQuery.descend(relation); } ++count; } } else { if (OperatorType.EQUAL.equals(queryParameter.equals().operator())) { query.descend(paramName).constrain(value).equal(); } else if (OperatorType.SMALLER.equals(queryParameter.equals().operator())) { query.descend(paramName).constrain(value).smaller(); } else if (OperatorType.GREATER.equals(queryParameter.equals().operator().getValue())) { query.descend(paramName).constrain(value).greater(); } else if (OperatorType.SMALLER_OR_EQUAL.equals(queryParameter.equals().operator())) { query.descend(paramName).constrain(value).smaller().equal(); } else if (OperatorType.GREATER_OR_EQUAL.equals(queryParameter.equals().operator())) { query.descend(paramName).constrain(value).greater().equal(); } } } else { if (!Modifier.isTransient(field.getModifiers())) { final FindBy findBy = field.getType().getAnnotation(FindBy.class); if (findBy != null) { Query subquery = query.descend(field.getName()); final String[] findParts = findBy.value().split("\\."); for (final String find : findParts) { subquery = subquery.descend(find); } if (findBy.like()) { subquery.constrain(value.toString()).like(); } else { subquery.constrain(value.toString()); } } else if (String.class.isAssignableFrom(field.getType())) { final Like like = field.getAnnotation(Like.class); if (like == null) { query.descend(field.getName()).constrain(value); } else { query.descend(field.getName()).constrain(value).like(); } } else if (VulpeEntity.class.isAssignableFrom(field.getType())) { if (isNotEmpty(value)) { query.descend(field.getName()).constrain(value); } } else if (List.class.isAssignableFrom(field.getType())) { final List values = (List) value; if (!values.isEmpty()) { final Query subqy = query.descend(field.getName()); for (Object object : values) { subqy.constrain(object); } } } else if (Object[].class.isAssignableFrom(field.getType())) { final Query subqy = query.descend(field.getName()); final Object[] values = (Object[]) value; for (Object object : values) { subqy.constrain(object); } } else if (!field.isAnnotationPresent(Transient.class) && !field.getName().equals(DB4O.SELECTED)) { query.descend(field.getName()).constrain(value); } } } } } return query; }
From source file:org.kuali.rice.core.framework.persistence.jpa.metadata.MetadataManager.java
private static void extractFieldMetadata(Class clazz, EntityDescriptor entityDescriptor) { // Don't want to get parent fields if overridden in children since we are walking the tree from child to parent Set<String> cachedFields = new HashSet<String>(); do {//from www . ja v a2 s . co m for (Field field : clazz.getDeclaredFields()) { if (cachedFields.contains(field.getName())) { continue; } cachedFields.add(field.getName()); int mods = field.getModifiers(); if (Modifier.isFinal(mods) || Modifier.isStatic(mods) || Modifier.isTransient(mods) || field.isAnnotationPresent(Transient.class)) { continue; } // Basic Fields FieldDescriptor fieldDescriptor = new FieldDescriptor(); fieldDescriptor.setClazz(field.getType()); fieldDescriptor.setTargetClazz(field.getType()); fieldDescriptor.setName(field.getName()); if (field.isAnnotationPresent(Id.class)) { fieldDescriptor.setId(true); if (entityDescriptor.getIdClass() != null) { // pull the column from IdClass try { Field idClassField = entityDescriptor.getIdClass().getDeclaredField(field.getName()); idClassField.setAccessible(true); addColumnInformationToFieldDescriptor(fieldDescriptor, idClassField); } catch (Exception e) { e.printStackTrace(); } } } if (field.isAnnotationPresent(Column.class)) { if (!field.isAnnotationPresent(Id.class) || entityDescriptor.getIdClass() == null) { // only populate if we haven't populated already addColumnInformationToFieldDescriptor(fieldDescriptor, field); } } else if (!field.isAnnotationPresent(Id.class) || entityDescriptor.getIdClass() == null) { fieldDescriptor.setColumn(field.getName()); } if (field.isAnnotationPresent(Version.class)) { fieldDescriptor.setVersion(true); } if (field.isAnnotationPresent(Lob.class)) { fieldDescriptor.setLob(true); } if (field.isAnnotationPresent(Temporal.class)) { fieldDescriptor.setTemporal(true); fieldDescriptor.setTemporalType(field.getAnnotation(Temporal.class).value()); } // Relationships if (field.isAnnotationPresent(OneToOne.class)) { OneToOneDescriptor descriptor = new OneToOneDescriptor(); OneToOne relation = field.getAnnotation(OneToOne.class); descriptor.setAttributeName(field.getName()); if (relation.targetEntity().equals(void.class)) { descriptor.setTargetEntity(field.getType()); } else { descriptor.setTargetEntity(relation.targetEntity()); fieldDescriptor.setTargetClazz(relation.targetEntity()); } descriptor.setCascade(relation.cascade()); descriptor.setFetch(relation.fetch()); descriptor.setMappedBy(relation.mappedBy()); descriptor.setOptional(relation.optional()); if (field.isAnnotationPresent(JoinColumn.class)) { JoinColumn jc = field.getAnnotation(JoinColumn.class); descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); FieldDescriptor jcFkField = entityDescriptor.getFieldByColumnName(jc.name()); if (jcFkField != null) { descriptor.addFkField(jcFkField.getName()); } else { //check to see if foreign key is in an AttributeOverride annotation if (clazz.isAnnotationPresent(AttributeOverrides.class)) { for (AttributeOverride override : ((AttributeOverrides) clazz .getAnnotation(AttributeOverrides.class)).value()) { if (jc.name().equals(override.column().name())) { entityDescriptor.getFieldByName(override.name()) .setColumn(override.column().name()); jcFkField = entityDescriptor.getFieldByName(override.name()); if (jcFkField != null) { descriptor.addFkField(jcFkField.getName()); } } } } if (clazz.isAnnotationPresent(AttributeOverride.class)) { AttributeOverride override = (AttributeOverride) clazz .getAnnotation(AttributeOverride.class); if (jc.name().equals(override.column().name())) { entityDescriptor.getFieldByName(override.name()) .setColumn(override.column().name()); jcFkField = entityDescriptor.getFieldByName(override.name()); if (jcFkField != null) { descriptor.addFkField(jcFkField.getName()); } } } } //descriptor.addFkField(entityDescriptor.getFieldByColumnName(jc.name()).getName()); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); } if (field.isAnnotationPresent(JoinColumns.class)) { JoinColumns jcs = field.getAnnotation(JoinColumns.class); for (JoinColumn jc : jcs.value()) { descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); descriptor.addFkField(entityDescriptor.getFieldByColumnName(jc.name()).getName()); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); } } entityDescriptor.add(descriptor); } if (field.isAnnotationPresent(OneToMany.class)) { OneToManyDescriptor descriptor = new OneToManyDescriptor(); OneToMany relation = field.getAnnotation(OneToMany.class); descriptor.setAttributeName(field.getName()); if (relation.targetEntity().equals(void.class)) { descriptor.setTargetEntity( (Class) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0]); } else { descriptor.setTargetEntity(relation.targetEntity()); fieldDescriptor.setTargetClazz(relation.targetEntity()); } descriptor.setCascade(relation.cascade()); descriptor.setFetch(relation.fetch()); descriptor.setMappedBy(relation.mappedBy()); EntityDescriptor mappedBy = (entityDescriptor.getClazz().equals(descriptor.getTargetEntity())) ? entityDescriptor : MetadataManager.getEntityDescriptor(descriptor.getTargetEntity()); ObjectDescriptor od = mappedBy.getObjectDescriptorByName(descriptor.getMappedBy()); if (od != null) { for (String fk : od.getForeignKeyFields()) { descriptor.addFkField(fk); } } if (field.isAnnotationPresent(JoinTable.class)) { JoinTable jt = field.getAnnotation(JoinTable.class); for (JoinColumn jc : jt.joinColumns()) { descriptor.addFkField(entityDescriptor.getFieldByColumnName(jc.name()).getName()); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); } for (JoinColumn jc : jt.inverseJoinColumns()) { descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); descriptor.addInverseJoinColumnDescriptor(constructJoinDescriptor(jc)); } } else { if (field.isAnnotationPresent(JoinColumn.class)) { JoinColumn jc = field.getAnnotation(JoinColumn.class); FieldDescriptor jcFkField = entityDescriptor.getFieldByColumnName(jc.name()); if (jcFkField != null) { descriptor.addFkField(jcFkField.getName()); } descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); } if (field.isAnnotationPresent(JoinColumns.class)) { JoinColumns jcs = field.getAnnotation(JoinColumns.class); for (JoinColumn jc : jcs.value()) { descriptor.addFkField(entityDescriptor.getFieldByColumnName(jc.name()).getName()); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); } } } entityDescriptor.add(descriptor); } if (field.isAnnotationPresent(ManyToOne.class)) { ManyToOne relation = field.getAnnotation(ManyToOne.class); ManyToOneDescriptor descriptor = new ManyToOneDescriptor(); descriptor.setAttributeName(field.getName()); if (relation.targetEntity().equals(void.class)) { descriptor.setTargetEntity(field.getType()); } else { descriptor.setTargetEntity(relation.targetEntity()); fieldDescriptor.setTargetClazz(relation.targetEntity()); } descriptor.setCascade(relation.cascade()); descriptor.setFetch(relation.fetch()); descriptor.setOptional(relation.optional()); if (field.isAnnotationPresent(JoinColumn.class)) { JoinColumn jc = field.getAnnotation(JoinColumn.class); descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); FieldDescriptor jcFkField = entityDescriptor.getFieldByColumnName(jc.name()); if (jcFkField != null) { descriptor.addFkField(jcFkField.getName()); } //descriptor.addFkField(entityDescriptor.getFieldByColumnName(jc.name()).getName()); //descriptor.addFkField(entitesByClass.get(field.getType()).getFieldByColumnName(jc.name()).getName()); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); } if (field.isAnnotationPresent(JoinColumns.class)) { JoinColumns jcs = field.getAnnotation(JoinColumns.class); for (JoinColumn jc : jcs.value()) { descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); descriptor.addFkField(entityDescriptor.getFieldByColumnName(jc.name()).getName()); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); } } entityDescriptor.add(descriptor); } if (field.isAnnotationPresent(ManyToMany.class)) { ManyToManyDescriptor descriptor = new ManyToManyDescriptor(); ManyToMany relation = field.getAnnotation(ManyToMany.class); descriptor.setAttributeName(field.getName()); if (relation.targetEntity().equals(void.class)) { descriptor.setTargetEntity( (Class) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0]); } else { descriptor.setTargetEntity(relation.targetEntity()); fieldDescriptor.setTargetClazz(relation.targetEntity()); } descriptor.setCascade(relation.cascade()); descriptor.setFetch(relation.fetch()); descriptor.setMappedBy(relation.mappedBy()); if (field.isAnnotationPresent(JoinTable.class)) { JoinTable jt = field.getAnnotation(JoinTable.class); descriptor.setJoinTableName(jt.name()); for (JoinColumn jc : jt.joinColumns()) { descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); descriptor.addFkField(entityDescriptor.getFieldByColumnName(jc.name()).getName()); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); } for (JoinColumn jc : jt.inverseJoinColumns()) { descriptor.addInverseJoinColumnDescriptor(constructJoinDescriptor(jc)); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); // TODO: Should we add inverse join columns? } } else { if (field.isAnnotationPresent(JoinColumn.class)) { JoinColumn jc = field.getAnnotation(JoinColumn.class); FieldDescriptor jcFkField = entityDescriptor.getFieldByColumnName(jc.name()); if (jcFkField != null) { descriptor.addFkField(jcFkField.getName()); } descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); } if (field.isAnnotationPresent(JoinColumns.class)) { JoinColumns jcs = field.getAnnotation(JoinColumns.class); for (JoinColumn jc : jcs.value()) { descriptor.addJoinColumnDescriptor(constructJoinDescriptor(jc)); descriptor.addFkField(entityDescriptor.getFieldByColumnName(jc.name()).getName()); descriptor.setInsertable(jc.insertable()); descriptor.setUpdateable(jc.updatable()); } } } entityDescriptor.add(descriptor); } // Add the field to the entity entityDescriptor.add(fieldDescriptor); } clazz = clazz.getSuperclass(); } while (clazz != null && !(clazz.equals(Object.class))); }