private boolean isReadIgnored(Object instance, String propertyName) { PropertyAccessor accessor = PropertyProxyUtils.getPropertyAccessor(this.conversionService, this.useDirectFieldAccess, instance); if (!accessor.isReadableProperty(propertyName)) { return true; } if (this.useDirectFieldAccess) { AmfIgnoreField ignoreField = accessor.getPropertyTypeDescriptor(propertyName).getAnnotation(AmfIgnoreField.class); return ignoreField != null && ignoreField.onSerialization(); } else { PropertyDescriptor pd = ((BeanWrapper)accessor).getPropertyDescriptor(propertyName); return pd.getReadMethod().getAnnotation(AmfIgnore.class) != null; } }
private boolean isWriteIgnored(Object instance, String propertyName) { PropertyAccessor accessor = PropertyProxyUtils.getPropertyAccessor(this.conversionService, this.useDirectFieldAccess, instance); if (!accessor.isWritableProperty(propertyName)) { return true; } if (this.useDirectFieldAccess) { AmfIgnoreField ignoreField = accessor.getPropertyTypeDescriptor(propertyName).getAnnotation(AmfIgnoreField.class); return ignoreField != null && ignoreField.onDeserialization(); } else { PropertyDescriptor pd = ((BeanWrapper)accessor).getPropertyDescriptor(propertyName); return pd.getWriteMethod().getAnnotation(AmfIgnore.class) != null; } }
/** * {@inheritDoc} * * Delegates to the configured {@link ConversionService} to potentially convert the current value to the actual type of the property. */ @Override public Object getValue(Object instance, String propertyName) { PropertyAccessor accessor = PropertyProxyUtils.getPropertyAccessor(this.conversionService, this.useDirectFieldAccess, instance); Object value = accessor.getPropertyValue(propertyName); if(log.isDebugEnabled()) { getType(instance, propertyName); log.debug("Actual type of value for property '"+propertyName+"' on instance "+instance+" is "+(value != null ? value.getClass() : null)); } TypeDescriptor targetType = accessor.getPropertyTypeDescriptor(propertyName); TypeDescriptor sourceType = value == null ? targetType : TypeDescriptor.valueOf(value.getClass()); if (this.conversionService.canConvert(sourceType, targetType)) { value = this.conversionService.convert(value, sourceType, targetType); } return value; }