com.fasterxml.jackson.databind.introspect.AnnotatedConstructor Java Examples
The following examples show how to use
com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.
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: JacksonLombokAnnotationIntrospector.java From jackson-lombok with MIT License | 6 votes |
@Override public boolean hasCreatorAnnotation(Annotated annotated) { if (super.hasCreatorAnnotation(annotated)) { return true; } else if (!(annotated instanceof AnnotatedConstructor)) { return false; } else { AnnotatedConstructor annotatedConstructor = (AnnotatedConstructor) annotated; ConstructorProperties properties = getConstructorPropertiesAnnotation(annotatedConstructor); if (properties == null) { return false; } else { addJacksonAnnotationsToContructorParameters(annotatedConstructor); return true; } } }
Example #2
Source File: AutoMatterAnnotationIntrospector.java From auto-matter with Apache License 2.0 | 5 votes |
@Override public boolean hasCreatorAnnotation(final Annotated a) { if (!(a instanceof AnnotatedConstructor)) { return false; } final AnnotatedConstructor ctor = (AnnotatedConstructor) a; if (ctor.getParameterCount() == 0) { return true; } final AutoMatter.Field field = ctor.getParameter(0).getAnnotation(AutoMatter.Field.class); return field != null; }
Example #3
Source File: JacksonLombokAnnotationIntrospector.java From jackson-lombok with MIT License | 5 votes |
private void addJacksonAnnotationsToContructorParameters(AnnotatedConstructor annotatedConstructor) { ConstructorProperties properties = getConstructorPropertiesAnnotation(annotatedConstructor); for (int i = 0; i < annotatedConstructor.getParameterCount(); i++) { String name = properties.value()[i]; AnnotatedParameter parameter = annotatedConstructor.getParameter(i); Field field = null; try { field = annotatedConstructor.getDeclaringClass().getDeclaredField(name); } catch (NoSuchFieldException ignored) { } addJacksonAnnotationsToConstructorParameter(field, parameter, name); } }
Example #4
Source File: JacksonLombokAnnotationIntrospector.java From jackson-lombok with MIT License | 4 votes |
private ConstructorProperties getConstructorPropertiesAnnotation(AnnotatedConstructor annotatedConstructor) { Constructor<?> constructor = annotatedConstructor.getAnnotated(); return constructor.getAnnotation(ConstructorProperties.class); }