private Property findIdPropertyByName( List<Property> beanProperties, EntityDefinition entityDefinition) { for (Property property : beanProperties) { if (property.getName().equals(entityDefinition.getIdPropertyName())) { return property; } } throw new JaversException( JaversExceptionCode.PROPERTY_NOT_FOUND, entityDefinition.getIdPropertyName(), entityDefinition.getClazz().getName()); }
public Entity create(EntityDefinition entityDefinition) { List<Property> properties = propertyScanner.scan(entityDefinition.getClazz()); Property idProperty = null; if (entityDefinition.hasCustomId()) { if (entityDefinition.hasCustomIdDefinedByName()) { idProperty = findIdPropertyByName(properties, entityDefinition); } else { idProperty = entityDefinition.getIdProperty(); } } List<Property> filteredProperties = filterIgnored(properties, entityDefinition); return new Entity(entityDefinition.getClazz(), filteredProperties, idProperty); }