@Override public String findSerializablePropertyName(AnnotatedField af) { JsonProperty pann = af.getAnnotation(JsonProperty.class); if (pann != null) { return pann.value(); } // Also: having JsonSerialize implies it is such a property // 09-Apr-2010, tatu: Ditto for JsonView if (af.hasAnnotation(JsonSerialize.class) || af.hasAnnotation(JsonView.class)) { return ""; } return null; }
public String getFullName() { return getDeclaringClass().getName() + "#" + getName(); }
@Override public AnnotatedField withAnnotations(AnnotationMap ann) { return new AnnotatedField(_field, ann); }
@Override public AnnotatedField getField() { if (_fields == null) { return null; } // If multiple, verify that they do not conflict... AnnotatedField field = _fields.value; Node<AnnotatedField> next = _fields.next; for (; next != null; next = next.next) { AnnotatedField nextField = next.value; Class<?> fieldClass = field.getDeclaringClass(); Class<?> nextClass = nextField.getDeclaringClass(); if (fieldClass != nextClass) { if (fieldClass.isAssignableFrom(nextClass)) { // next is more specific field = nextField; continue; } if (nextClass.isAssignableFrom(fieldClass)) { // getter more specific continue; } } throw new IllegalArgumentException("Multiple fields representing property \""+getName()+"\": " +field.getFullName()+" vs "+nextField.getFullName()); } return field; }
field.fixAccess(); JavaType t0 = beanDesc.bindingsForBeanType().resolveType(field.getGenericType()); BeanProperty.Std property = new BeanProperty.Std(name, t0, beanDesc.getClassAnnotations(), field); JavaType type = resolveType(config, beanDesc, t0, field, property);
propName = af.getName(); continue; propName = af.getName(); if (old.getDeclaringClass() == af.getDeclaringClass()) { String oldDesc = old.getFullName(); String newDesc = af.getFullName(); throw new IllegalArgumentException("Multiple fields representing property \""+propName+"\": "+oldDesc+" vs "+newDesc);
@Override public String toString() { return "[field "+getName()+", annotations: "+_annotations+"]"; } }
public FieldProperty(String name, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations, AnnotatedField field) { super(name, type, typeDeser, contextAnnotations); _annotated = field; _field = field.getAnnotated(); }
@Override public <A extends Annotation> A getAnnotation(Class<A> acls) { return _annotated.getAnnotation(acls); }
protected SettableBeanProperty constructSettableProperty(DeserializationConfig config, BasicBeanDescription beanDesc, String name, AnnotatedField field) throws JsonMappingException { // need to ensure method is callable (for non-public) if (config.isEnabled(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS)) { field.fixAccess(); } JavaType type = resolveType(config, beanDesc, field.getGenericType(), field); /* First: does the Method specify the deserializer to use? * If so, let's use it. */ JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(config, field); Field f = field.getAnnotated(); if (propDeser != null) { SettableBeanProperty prop = new SettableBeanProperty.FieldProperty(name, type, f); prop.setValueDeserializer(propDeser); return prop; } // Otherwise, method may specify more specific (sub-)class for // value (no need to check if explicit deser was specified): type = modifyTypeByAnnotation(config, field, type); return new SettableBeanProperty.FieldProperty(name, type, f); }
propName = af.getName(); if (!autodetect || !af.isPublic()) { continue; propName = af.getName(); String oldDesc = old.getFullName(); String newDesc = af.getFullName(); throw new IllegalArgumentException("Multiple fields representing property \""+propName+"\": "+oldDesc+" vs "+newDesc);
protected void _addFieldMixIns(Class<?> mixin, List<AnnotatedField> fields) { for (Field f : mixin.getDeclaredFields()) { /* there are some dummy things (static, synthetic); better * ignore */ if (!_isIncludableField(f)) { continue; } String name = f.getName(); for (AnnotatedField af : fields) { // anything to mask? (if not, quietly ignore) if (name.equals(af.getName())) { for (Annotation a : f.getDeclaredAnnotations()) { if (_annotationIntrospector.isHandled(a)) { af.addOrOverride(a); } } break; } } } }
for (Annotation a : mixinField.getDeclaredAnnotations()) { if (_annotationIntrospector.isHandled(a)) { maskedField.addOrOverride(a);
builder.addIgnorable(af.getName()); AnnotatedField field = en.getValue(); Class<?> type = field.getRawType(); if (isIgnorableType(config, beanDesc, type, ignoredTypes)) {
@Override public void setValue(Object pojo, Object value) throws IllegalArgumentException { try { _field.set(pojo, value); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Failed to setValue() for field " +getFullName()+": "+e.getMessage(), e); } }
@Override public String nameForField(MapperConfig<?> config, AnnotatedField field, String defaultName) { if (field.getDeclaringClass().isAnnotationPresent(JsonSnakeCase.class)) { return snakeCase.nameForField(config, field, defaultName); } return super.nameForField(config, field, defaultName); }
AnnotatedField af = en.getValue(); if (fixAccess) { af.fixAccess();
field.fixAccess(); JavaType t0 = beanDesc.bindingsForBeanType().resolveType(field.getGenericType()); BeanProperty.Std property = new BeanProperty.Std(name, t0, beanDesc.getClassAnnotations(), field); JavaType type = resolveType(config, beanDesc, t0, field, property);
@Override public AnnotatedField getField() { if (_fields == null) { return null; } // If multiple, verify that they do not conflict... AnnotatedField field = _fields.value; Node<AnnotatedField> next = _fields.next; for (; next != null; next = next.next) { AnnotatedField nextField = next.value; Class<?> fieldClass = field.getDeclaringClass(); Class<?> nextClass = nextField.getDeclaringClass(); if (fieldClass != nextClass) { if (fieldClass.isAssignableFrom(nextClass)) { // next is more specific field = nextField; continue; } if (nextClass.isAssignableFrom(fieldClass)) { // getter more specific continue; } } throw new IllegalArgumentException("Multiple fields representing property \""+getName()+"\": " +field.getFullName()+" vs "+nextField.getFullName()); } return field; }
String implName = f.getName();