/** {@inheritDoc} */ public Object getValue(Object instance, String propertyName) { if (instance == null || propertyName == null) return null; BeanProperty bp = getBeanProperty(instance, propertyName); if (bp != null) return getBeanValue(instance, bp); SerializationContext context = getSerializationContext(); if (!ignorePropertyErrors(context)) { // Property '{propertyName}' not found on class '{alias}'. MessageException ex = new MessageException(); ex.setMessage(UNKNOWN_PROPERTY_ERROR, new Object[] {propertyName, getAlias(instance)}); throw ex; } return null; }
@Override public List getPropertyNames ( Object instance ) { List<String> l = super.getPropertyNames(instance); l.addAll(this.values.keySet()); return new ArrayList<>(this.values.keySet()); }
public Object getValue(Object instance, String propertyName) { if (instance == null || propertyName == null) return null; // First, check for bean property Object value = super.getValue(instance, propertyName); // Then check for Dictionary entry if (value == null && instance instanceof Dictionary) { Dictionary dictionary = (Dictionary)instance; value = dictionary.get(propertyName); } return value; }
BeanProperty bp = getBeanProperty(instance, propertyName); SerializationContext context = getSerializationContext(); if (Log.isWarn() && logPropertyErrors(context)) new Object[] {propertyName, getAlias(instance)}, e); if (!ignorePropertyErrors(context)) ex.setMessage(FAILED_PROPERTY_WRITE_ERROR, new Object[] {propertyName, getAlias(instance)}); ex.setRootCause(e); throw ex; SerializationContext context = getSerializationContext(); if (Log.isWarn() && logPropertyErrors(context)) new Object[] {propertyName, getAlias(instance)}); if (!ignorePropertyErrors(context)) ex.setMessage(NON_WRITABLE_PROPERTY_ERROR, new Object[] {propertyName, getAlias(instance)}); throw ex; SerializationContext context = getSerializationContext(); if (Log.isWarn() && logPropertyErrors(context))
props = getBeanProperties(instance); return props == null? null : (BeanProperty)props.get(propertyName); PropertyDescriptorCacheEntry pce = getPropertyDescriptorCacheEntry(c); if (pce == null) return null; if (readMethod != null && isPublicAccessor(readMethod.getModifiers()) && !getIncludeReadOnly() && writeMethod == null) return null; if ((excludes != null && excludes.contains(propertyName)) || isPropertyIgnored(c, propertyName)) return null; if (isPublicField(modifiers) && pName.equals(propertyName)) return ((excludes != null && excludes.contains(propertyName)) || isPropertyIgnored(c, propertyName))? null : new BeanProperty(propertyName, field.getType(), null, null, field);
/** {@inheritDoc} */ public String getAlias(Object instance) { return getClassName(instance); }
/** {@inheritDoc} */ public Class getType(Object instance, String propertyName) { if (instance == null || propertyName == null) return null; BeanProperty bp = getBeanProperty(instance, propertyName); return bp == null? null : bp.getType(); }
if (getIncludeReadOnly()) propertyNames = new ArrayList<String>(getBeanProperties(instance).keySet()); if (getIncludeReadOnly())
if (getIncludeReadOnly()) pce = new PropertyDescriptorCacheEntry(); pce.propertyDescriptors = beanInfo.getPropertyDescriptors(); pce.propertiesByName = createPropertiesByNameMap(pce.propertyDescriptors, c.getFields()); if (cachePropertiesDescriptors) if (getIncludeReadOnly())
@Override public String getAlias(Object instance) { return removeCglibClassSuffix(super.getAlias(instance)); }
/** * Return an array of JavaBean property descriptors for a class. * @param c the class to examine. * @return an array ot JavaBean PropertyDescriptors. */ private PropertyDescriptor [] getPropertyDescriptors(Class c) { PropertyDescriptorCacheEntry pce = getPropertyDescriptorCacheEntry(c); return pce == null? null : pce.propertyDescriptors; }
/** {@inheritDoc} */ public Object getValue(Object instance, String propertyName) { if (instance == null || propertyName == null) return null; Object value = null; // First, check for bean property BeanProperty bp = getBeanProperty(instance, propertyName); if (bp != null) { value = super.getBeanValue(instance, bp); } // Then check for Map entry if (value == null && instance instanceof Map) { Map map = (Map)instance; value = map.get(propertyName); } return value; }
proxy = new BeanProxy();
properties = getBeanProperties(instance);
pce = new PropertyDescriptorCacheEntry(); pce.propertyDescriptors = beanInfo.getPropertyDescriptors(); pce.propertiesByName = createPropertiesByNameMap(pce.propertyDescriptors, c.getFields()); if (cachePropertiesDescriptors)
BeanProperty bp = getBeanProperty(instance, propertyName); SerializationContext context = getSerializationContext(); if (Log.isWarn() && logPropertyErrors(context)) new Object[] {propertyName, getAlias(instance)}, e); if (!ignorePropertyErrors(context)) ex.setMessage(FAILED_PROPERTY_WRITE_ERROR, new Object[] {propertyName, getAlias(instance)}); ex.setRootCause(e); throw ex; SerializationContext context = getSerializationContext(); if (Log.isWarn() && logPropertyErrors(context)) new Object[] {propertyName, getAlias(instance)}); if (!ignorePropertyErrors(context)) ex.setMessage(NON_WRITABLE_PROPERTY_ERROR, new Object[] {propertyName, getAlias(instance)}); throw ex; SerializationContext context = getSerializationContext(); if (Log.isWarn() && logPropertyErrors(context))
props = getBeanProperties(instance); return props == null? null : (BeanProperty)props.get(propertyName); PropertyDescriptorCacheEntry pce = getPropertyDescriptorCacheEntry(c); if (pce == null) return null; if (readMethod != null && isPublicAccessor(readMethod.getModifiers()) && !getIncludeReadOnly() && writeMethod == null) return null; if ((excludes != null && excludes.contains(propertyName)) || isPropertyIgnored(c, propertyName)) return null; if (isPublicField(modifiers) && pName.equals(propertyName)) return ((excludes != null && excludes.contains(propertyName)) || isPropertyIgnored(c, propertyName))? null : new BeanProperty(propertyName, field.getType(), null, null, field);
/** {@inheritDoc} */ public String getAlias(Object instance) { return getClassName(instance); }
/** {@inheritDoc} */ public Class getType(Object instance, String propertyName) { if (instance == null || propertyName == null) return null; BeanProperty bp = getBeanProperty(instance, propertyName); if (bp != null) { return bp.getType(); } return null; }
if (getIncludeReadOnly()) propertyNames = new ArrayList<String>(getBeanProperties(instance).keySet()); if (getIncludeReadOnly())