/** * Extracts type of current property. */ protected Class extractType(BeanProperty bp) { Getter getter = bp.getGetter(isDeclared); if (getter != null) { if (bp.index != null) { Class type = getter.getGetterRawComponentType(); return type == null ? Object.class : type; } return getter.getGetterRawType(); } return null; // this should not happens }
/** * Converts <b>Map</b> index to key type. If conversion fails, original value will be returned. */ protected Object convertIndexToMapKey(Getter getter, Object index) { Class indexType = null; if (getter != null) { indexType = getter.getGetterRawKeyComponentType(); } // check if set if (indexType == null) { indexType = Object.class; // marker for no generic type } if (indexType == Object.class) { return index; } try { return convertType(index, indexType); } catch (Exception ignore) { return index; } }
/** * Reads property using property descriptor. */ private Object readProperty(final Object source, final PropertyDescriptor propertyDescriptor) { Getter getter = propertyDescriptor.getGetter(declared); if (getter != null) { try { return getter.invokeGetter(source); } catch (Exception ex) { throw new JsonException(ex); } } return null; }
/** * Extracts generic component type of a property. Returns <code>Object.class</code> * when property does not have component. */ protected Class extractGenericComponentType(Getter getter) { Class componentType = null; if (getter != null) { componentType = getter.getGetterRawComponentType(); } if (componentType == null) { componentType = Object.class; } return componentType; }
Object result; try { result = getter.invokeGetter(bp.bean); } catch (Exception ex) { if (isSilent) {
/** * Extracts generic component type of a property. Returns <code>Object.class</code> * when property does not have component. */ protected Class extractGenericComponentType(final Getter getter) { Class componentType = null; if (getter != null) { componentType = getter.getGetterRawComponentType(); } if (componentType == null) { componentType = Object.class; } return componentType; }
/** * Extracts type of current property. */ protected Class extractType(final BeanProperty bp) { Getter getter = bp.getGetter(isDeclared); if (getter != null) { if (bp.index != null) { Class type = getter.getGetterRawComponentType(); return type == null ? Object.class : type; } return getter.getGetterRawType(); } return null; // this should not happens }
Object result; try { result = getter.invokeGetter(bp.bean); } catch (Exception ex) { if (isSilent) {
/** * Resolves component type for given property descriptor. */ public Class resolveComponentType(boolean declared) { Class componentType = null; Getter getter = getGetter(declared); if (getter != null) { componentType = getter.getGetterRawComponentType(); } if (componentType == null) { FieldDescriptor fieldDescriptor = getFieldDescriptor(); if (fieldDescriptor != null) { componentType = fieldDescriptor.getRawComponentType(); } } return componentType; }
/** * Converts <b>Map</b> index to key type. If conversion fails, original value will be returned. */ protected Object convertIndexToMapKey(final Getter getter, final Object index) { Class indexType = null; if (getter != null) { indexType = getter.getGetterRawKeyComponentType(); } // check if set if (indexType == null) { indexType = Object.class; // marker for no generic type } if (indexType == Object.class) { return index; } try { return convertType(index, indexType); } catch (Exception ignore) { return index; } }
/** * Extracts type of current property. */ protected Class extractType(final BeanProperty bp) { Getter getter = bp.getGetter(isDeclared); if (getter != null) { if (bp.index != null) { Class type = getter.getGetterRawComponentType(); return type == null ? Object.class : type; } return getter.getGetterRawType(); } return null; // this should not happens }
Object result; try { result = getter.invokeGetter(bp.bean); } catch (Exception ex) { if (isSilent) {
/** * Resolves component type for given property descriptor. */ public Class resolveComponentType(final boolean declared) { Class componentType = null; Getter getter = getGetter(declared); if (getter != null) { componentType = getter.getGetterRawComponentType(); } if (componentType == null) { FieldDescriptor fieldDescriptor = getFieldDescriptor(); if (fieldDescriptor != null) { componentType = fieldDescriptor.getRawComponentType(); } } return componentType; }
/** * Resolves key type for given property descriptor. */ public Class resolveKeyType(boolean declared) { Class keyType = null; Getter getter = getGetter(declared); if (getter != null) { keyType = getter.getGetterRawKeyComponentType(); } if (keyType == null) { FieldDescriptor fieldDescriptor = getFieldDescriptor(); if (fieldDescriptor != null) { keyType = fieldDescriptor.getRawKeyComponentType(); } } return keyType; }
/** * Extracts generic component type of a property. Returns <code>Object.class</code> * when property does not have component. */ protected Class extractGenericComponentType(final Getter getter) { Class componentType = null; if (getter != null) { componentType = getter.getGetterRawComponentType(); } if (componentType == null) { componentType = Object.class; } return componentType; }
/** * Resolves key type for given property descriptor. */ public Class resolveKeyType(final boolean declared) { Class keyType = null; Getter getter = getGetter(declared); if (getter != null) { keyType = getter.getGetterRawKeyComponentType(); } if (keyType == null) { FieldDescriptor fieldDescriptor = getFieldDescriptor(); if (fieldDescriptor != null) { keyType = fieldDescriptor.getRawKeyComponentType(); } } return keyType; }
/** * Resolves component type for given property descriptor. */ public Class resolveComponentType(final boolean declared) { Class componentType = null; Getter getter = getGetter(declared); if (getter != null) { componentType = getter.getGetterRawComponentType(); } if (componentType == null) { FieldDescriptor fieldDescriptor = getFieldDescriptor(); if (fieldDescriptor != null) { componentType = fieldDescriptor.getRawComponentType(); } } return componentType; }
/** * Converts <b>Map</b> index to key type. If conversion fails, original value will be returned. */ protected Object convertIndexToMapKey(final Getter getter, final Object index) { Class indexType = null; if (getter != null) { indexType = getter.getGetterRawKeyComponentType(); } // check if set if (indexType == null) { indexType = Object.class; // marker for no generic type } if (indexType == Object.class) { return index; } try { return convertType(index, indexType); } catch (Exception ignore) { return index; } }
/** * Resolves key type for given property descriptor. */ public Class resolveKeyType(final boolean declared) { Class keyType = null; Getter getter = getGetter(declared); if (getter != null) { keyType = getter.getGetterRawKeyComponentType(); } if (keyType == null) { FieldDescriptor fieldDescriptor = getFieldDescriptor(); if (fieldDescriptor != null) { keyType = fieldDescriptor.getRawKeyComponentType(); } } return keyType; }