if ((obj != null) && (obj instanceof Entity)) {
Entity<?> entity = (Entity<?>) obj;
BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(entity.getClass()).getBeanDescriptor();
PropertyDescriptor propertyDescriptor = beanDescriptor.getProperty(EntityInterceptor.ENTITY_ID);
Class<?> clazz = propertyDescriptor.getType();
try {
Constructor<?> contructor = clazz.getConstructor(new Class[] { String.class });
Object fieldValue = contructor.newInstance(new Object[] { value });
WebLog.getInstance().getLog().info("Setting entity ID " + entityName + "[" + fieldValue + "]");
propertyDescriptor.setValue(entity, fieldValue);
} catch (NoSuchMethodException e) {
WebLog.getInstance().getLog().warning("Could not find constructor " + entity.getClass().getCanonicalName() + "(String). Parameter not setted");
} catch (Exception e) {
WebLog.getInstance().getLog().warning("Error in constructor " + entity.getClass().getCanonicalName() + "(String)");
WebLog.getInstance().getLog().log(Level.WARNING, e.getMessage(), e);