break; method = propertyDescriptor.getWriteMethod(); if (method != null && ( method.isAnnotationPresent(Id.class) ||
@Override public void defineProperty(String name) { if (type.length() == 0 || instantiator != null) properties.add(new MapProperty(converters, name)); else { try { // Try to find public getter/setter. PropertyDescriptor[] props = Introspector.getPropertyDescriptors(clazz); for (PropertyDescriptor prop : props) { if (name.equals(prop.getName()) && prop.getWriteMethod() != null && prop.getReadMethod() != null) { properties.add(new MethodProperty(converters, name, prop.getWriteMethod(), prop.getReadMethod())); return; } } // Try to find public field. Field field = clazz.getField(name); if (!Modifier.isStatic(field.getModifiers()) && !Modifier.isTransient(field.getModifiers())) properties.add(new FieldProperty(converters, field)); } catch (NoSuchFieldException e) { if ("uid".equals(name)) // ObjectProxy specific property... properties.add(new UIDProperty(converters)); else throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); } } }
for (PropertyDescriptor property : descs) { String propertyName = property.getName(); if (property.getWriteMethod() != null && property.getReadMethod() != null) { properties.add(new MethodProperty(converters, propertyName, property.getWriteMethod(), property.getReadMethod())); propertyNames.add(propertyName);
for (PropertyDescriptor property : descs) { String propertyName = property.getName(); if (property.getWriteMethod() != null && property.getReadMethod() != null) { properties.add(new MethodProperty(converters, propertyName, property.getWriteMethod(), property.getReadMethod())); propertyNames.add(propertyName);
if (name.equals(prop.getName()) && prop.getWriteMethod() != null && prop.getReadMethod() != null) { properties.add(new MethodProperty(converters, name, prop.getWriteMethod(), prop.getReadMethod())); return;
@Override public void defineProperty(String name) { if (type.length() == 0 || instantiator != null) properties.add(new MapProperty(converters, name)); else { try { // Try to find public getter/setter. PropertyDescriptor[] props = Introspector.getPropertyDescriptors(clazz); for (PropertyDescriptor prop : props) { if (name.equals(prop.getName()) && prop.getWriteMethod() != null && prop.getReadMethod() != null) { properties.add(new MethodProperty(converters, name, prop.getWriteMethod(), prop.getReadMethod())); return; } } // Try to find public field. Field field = clazz.getField(name); if (!Modifier.isStatic(field.getModifiers()) && !Modifier.isTransient(field.getModifiers())) properties.add(new FieldProperty(converters, field)); } catch (NoSuchFieldException e) { if ("uid".equals(name)) // ObjectProxy specific property... properties.add(new UIDProperty(converters)); else throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public void defineProperty(String name) { if (type.length() == 0 || instantiator != null) properties.add(new MapProperty(converters, name)); else { try { // Try to find public getter/setter. PropertyDescriptor[] props = Introspector.getPropertyDescriptors(clazz); for (PropertyDescriptor prop : props) { if (name.equals(prop.getName()) && prop.getWriteMethod() != null && prop.getReadMethod() != null) { properties.add(new MethodProperty(converters, name, prop.getWriteMethod(), prop.getReadMethod())); return; } } // Try to find public field. Field field = clazz.getField(name); if (!Modifier.isStatic(field.getModifiers()) && !Modifier.isTransient(field.getModifiers())) properties.add(new FieldProperty(converters, field)); } catch (NoSuchFieldException e) { if ("uid".equals(name)) // ObjectProxy specific property... properties.add(new UIDProperty(converters)); else throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); } } }
for (PropertyDescriptor property : descs) { String propertyName = property.getName(); if (property.getWriteMethod() != null && property.getReadMethod() != null) { properties.add(new MethodProperty(converters, propertyName, property.getWriteMethod(), property.getReadMethod())); propertyNames.add(propertyName);
for (PropertyDescriptor property : descs) { String propertyName = property.getName(); if (property.getWriteMethod() != null && property.getReadMethod() != null) { properties.add(new MethodProperty(converters, propertyName, property.getWriteMethod(), property.getReadMethod())); propertyNames.add(propertyName);
@Override public void setPropertyValue(Object entity, String name, Object value) { if (entity == null) return; try { boolean found = false; PropertyDescriptor[] pds = Introspector.getPropertyDescriptors(entity.getClass()); for (PropertyDescriptor pd : pds) { if (pd.getName().equals(name) && pd.getWriteMethod() != null) { Object oldValue = null; if (pd.getReadMethod() != null) oldValue = pd.getReadMethod().invoke(entity); pd.getWriteMethod().invoke(entity, value); if (pd.getReadMethod() != null) PropertyChangeHelper.firePropertyChange(entity, name, oldValue, value); found = true; break; } } if (!found) super.setPropertyValue(entity, name, value); } catch (Exception e) { throw new RuntimeException("Could not set property " + name + " on entity " + entity, e); } }
for (PropertyDescriptor property : descs) { String propertyName = property.getName(); if (property.getWriteMethod() != null && property.getReadMethod() != null) { properties.add(new MethodProperty(converters, propertyName, property.getWriteMethod(), property.getReadMethod())); propertyNames.add(propertyName);
for (PropertyDescriptor property : descs) { String propertyName = property.getName(); if (property.getWriteMethod() != null && property.getReadMethod() != null) { properties.add(new MethodProperty(converters, propertyName, property.getWriteMethod(), property.getReadMethod())); propertyNames.add(propertyName);
for (PropertyDescriptor property : descs) { String propertyName = property.getName(); if (property.getWriteMethod() != null && property.getReadMethod() != null) { properties.add(new MethodProperty(converters, propertyName, property.getWriteMethod(), property.getReadMethod())); propertyNames.add(propertyName);
for (PropertyDescriptor property : descs) { String propertyName = property.getName(); if (property.getWriteMethod() != null && property.getReadMethod() != null) { properties.add(new MethodProperty(converters, propertyName, property.getWriteMethod(), property.getReadMethod())); propertyNames.add(propertyName);
if (returnSettersWhenAvailable && propertyDescriptors != null) { for (PropertyDescriptor pd : propertyDescriptors) { if (pd.getName().equals(field.getName()) && pd.getWriteMethod() != null) { newFields.add(new MethodProperty(converters, field.getName(), pd.getWriteMethod(), pd.getReadMethod())); found = true; break;
if (returnSettersWhenAvailable && propertyDescriptors != null) { for (PropertyDescriptor pd : propertyDescriptors) { if (pd.getName().equals(field.getName()) && pd.getWriteMethod() != null) { newFields.add(new MethodProperty(converters, field.getName(), pd.getWriteMethod(), pd.getReadMethod())); found = true; break;
if (returnSettersWhenAvailable && propertyDescriptors != null) { for (PropertyDescriptor pd : propertyDescriptors) { if (pd.getName().equals(field.getName()) && pd.getWriteMethod() != null) { newFields.add(new MethodProperty(converters, field.getName(), pd.getWriteMethod(), pd.getReadMethod())); found = true; break;
if (returnSettersWhenAvailable && propertyDescriptors != null) { for (PropertyDescriptor pd : propertyDescriptors) { if (pd.getName().equals(field.getName()) && pd.getWriteMethod() != null) { newFields.add(new MethodProperty(converters, field.getName(), pd.getWriteMethod(), pd.getReadMethod())); found = true; break;
if (propertyDescriptor.getWriteMethod() != null) { Object value = mergeObject(me.getValue(), cache); value = converters.convert(value, propertyDescriptor.getWriteMethod().getGenericParameterTypes()[0]); propertyDescriptor.getWriteMethod().invoke(entity, value);