Java Code Examples for com.fasterxml.jackson.databind.introspect.AnnotatedMember#getName()
The following examples show how to use
com.fasterxml.jackson.databind.introspect.AnnotatedMember#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyAccessorCollector.java From jackson-modules-base with Apache License 2.0 | 6 votes |
@Override protected StackManipulation invocationOperation( AnnotatedMember annotatedMember, TypeDefinition beanClassDescription) { final String methodName = annotatedMember.getName(); @SuppressWarnings("unchecked") final MethodList<MethodDescription> matchingMethods = (MethodList<MethodDescription>) beanClassDescription.getDeclaredMethods().filter(named(methodName)); if (matchingMethods.size() == 1) { //method was declared on class return MethodInvocation.invoke(matchingMethods.getOnly()); } if (matchingMethods.isEmpty()) { //method was not found on class, try super class return invocationOperation(annotatedMember, beanClassDescription.getSuperClass()); } else { //should never happen throw new IllegalStateException("Could not find definition of method: " + methodName); } }
Example 2
Source File: PropertyAccessorCollector.java From jackson-modules-base with Apache License 2.0 | 6 votes |
@Override protected StackManipulation invocationOperation( AnnotatedMember annotatedMember, TypeDefinition beanClassDescription) { final String fieldName = annotatedMember.getName(); @SuppressWarnings("unchecked") final FieldList<FieldDescription> matchingFields = (FieldList<FieldDescription>) beanClassDescription.getDeclaredFields().filter(named(fieldName)); if (matchingFields.size() == 1) { //method was declared on class return FieldAccess.forField(matchingFields.getOnly()).read(); } if (matchingFields.isEmpty()) { //method was not found on class, try super class return invocationOperation(annotatedMember, beanClassDescription.getSuperClass()); } else { //should never happen throw new IllegalStateException("Could not find definition of field: " + fieldName); } }
Example 3
Source File: PropertyMutatorCollector.java From jackson-modules-base with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override protected StackManipulation invocationOperation(AnnotatedMember annotatedMember, TypeDefinition beanClassDescription) { final String fieldName = annotatedMember.getName(); final FieldList<FieldDescription> matchingFields = (FieldList<FieldDescription>) beanClassDescription.getDeclaredFields().filter(named(fieldName)); if (matchingFields.size() == 1) { //method was declared on class return FieldAccess.forField(matchingFields.getOnly()).write(); } if (matchingFields.isEmpty()) { //method was not found on class, try super class return invocationOperation(annotatedMember, beanClassDescription.getSuperClass()); } else { //should never happen throw new IllegalStateException("Could not find definition of field: " + fieldName); } }
Example 4
Source File: PropertyMutatorCollector.java From jackson-modules-base with Apache License 2.0 | 6 votes |
@Override protected StackManipulation invocationOperation(AnnotatedMember annotatedMember, TypeDefinition beanClassDescription) { final String methodName = annotatedMember.getName(); @SuppressWarnings("unchecked") final MethodList<MethodDescription> matchingMethods = (MethodList<MethodDescription>) beanClassDescription.getDeclaredMethods().filter(named(methodName)); if (matchingMethods.size() == 1) { //method was declared on class return MethodInvocation.invoke(matchingMethods.getOnly()); } if (matchingMethods.isEmpty()) { //method was not found on class, try super class return invocationOperation(annotatedMember, beanClassDescription.getSuperClass()); } else { //should never happen throw new IllegalStateException("Could not find definition of method: " + methodName); } }
Example 5
Source File: AutoMatterAnnotationIntrospector.java From auto-matter with Apache License 2.0 | 5 votes |
@Override public String findImplicitPropertyName(final AnnotatedMember member) { final AutoMatter.Field field = member.getAnnotation(AutoMatter.Field.class); if (field == null) { return null; } if (member instanceof AnnotatedParameter) { return field.value(); } if (member instanceof AnnotatedMethod) { return member.getName(); } return null; }
Example 6
Source File: IgnoranceUnitTest.java From tutorials with MIT License | 4 votes |
public boolean hasIgnoreMarker(AnnotatedMember m) { return m.getDeclaringClass() == IgnoranceMixinOrIntrospection.Vehicle.class && m.getName() == "model" || m.getDeclaringClass() == IgnoranceMixinOrIntrospection.Car.class || m.getName() == "towingCapacity" || super.hasIgnoreMarker(m); }