/** * Add given class to dictionary. * * @param cls Entity bean class */ @Override public void bindEntity(Class<?> cls) { String type = WordUtils.uncapitalize(cls.getSimpleName()); Class<?> duplicate = bindJsonApiToEntity.put(type, cls); if (duplicate != null && !duplicate.equals(cls)) { log.error("Duplicate binding {} for {}, {}", type, cls, duplicate); throw new DuplicateMappingException(type + " " + cls.getName() + ":" + duplicate.getName()); } entityBindings.put(cls, new EntityBinding(this, cls, type, type)); } }
/** * Add given class to dictionary. * * @param cls Entity bean class */ @Override public void bindEntity(Class<?> cls) { String type = WordUtils.uncapitalize(cls.getSimpleName()); Class<?> duplicate = bindJsonApiToEntity.put(type, cls); if (duplicate != null && !duplicate.equals(cls)) { log.error("Duplicate binding {} for {}, {}", type, cls, duplicate); throw new DuplicateMappingException(type + " " + cls.getName() + ":" + duplicate.getName()); } entityBindings.put(cls, new EntityBinding(this, cls, type, type)); } }
/** * Bind an id field to an entity. * * @param cls Class type to bind fields * @param type JSON API type identifier * @param fieldOrMethod Field or method to bind */ private void bindEntityId(Class<?> cls, String type, AccessibleObject fieldOrMethod) { String fieldName = getFieldName(fieldOrMethod); Class<?> fieldType = getFieldType(fieldOrMethod); //Add id field to type map for the entity fieldsToTypes.put(fieldName, fieldType); //Set id field, type, and name idField = fieldOrMethod; idType = fieldType; idFieldName = fieldName; fieldsToValues.put(fieldName, fieldOrMethod); if (idField != null && !fieldOrMethod.equals(idField)) { throw new DuplicateMappingException(type + " " + cls.getName() + ":" + fieldName); } }
/** * Bind an id field to an entity. * * @param cls Class type to bind fields * @param type JSON API type identifier * @param fieldOrMethod Field or method to bind */ private void bindEntityId(Class<?> cls, String type, AccessibleObject fieldOrMethod) { String fieldName = getFieldName(fieldOrMethod); Class<?> fieldType = getFieldType(fieldOrMethod); //Add id field to type map for the entity fieldsToTypes.put(fieldName, fieldType); //Set id field, type, and name idField = fieldOrMethod; idType = fieldType; idFieldName = fieldName; fieldsToValues.put(fieldName, fieldOrMethod); if (idField != null && !fieldOrMethod.equals(idField)) { throw new DuplicateMappingException(type + " " + cls.getName() + ":" + fieldName); } }
if (duplicate != null && !duplicate.equals(cls)) { log.error("Duplicate binding {} for {}, {}", type, cls, duplicate); throw new DuplicateMappingException(type + " " + cls.getName() + ":" + duplicate.getName());
if (duplicate != null && !duplicate.equals(cls)) { log.error("Duplicate binding {} for {}, {}", type, cls, duplicate); throw new DuplicateMappingException(type + " " + cls.getName() + ":" + duplicate.getName());