Java Code Examples for java.beans.ConstructorProperties#value()
The following examples show how to use
java.beans.ConstructorProperties#value() .
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: Java7SupportImpl.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public PropertyName findConstructorName(AnnotatedParameter p) { AnnotatedWithParams ctor = p.getOwner(); if (ctor != null) { ConstructorProperties props = ctor.getAnnotation(ConstructorProperties.class); if (props != null) { String[] names = props.value(); int ix = p.getIndex(); if (ix < names.length) { return PropertyName.construct(names[ix]); } } } return null; }
Example 2
Source File: ConstructorResolver.java From spring-analysis-note with MIT License | 5 votes |
@Nullable public static String[] evaluate(Constructor<?> candidate, int paramCount) { ConstructorProperties cp = candidate.getAnnotation(ConstructorProperties.class); if (cp != null) { String[] names = cp.value(); if (names.length != paramCount) { throw new IllegalStateException("Constructor annotated with @ConstructorProperties but not " + "corresponding to actual number of parameters (" + paramCount + "): " + candidate); } return names; } else { return null; } }
Example 3
Source File: ConstructorResolver.java From java-technology-stack with MIT License | 5 votes |
@Nullable public static String[] evaluate(Constructor<?> candidate, int paramCount) { ConstructorProperties cp = candidate.getAnnotation(ConstructorProperties.class); if (cp != null) { String[] names = cp.value(); if (names.length != paramCount) { throw new IllegalStateException("Constructor annotated with @ConstructorProperties but not " + "corresponding to actual number of parameters (" + paramCount + "): " + candidate); } return names; } else { return null; } }
Example 4
Source File: ConstructorResolver.java From lams with GNU General Public License v2.0 | 5 votes |
public static String[] evaluate(Constructor<?> candidate, int paramCount) { ConstructorProperties cp = candidate.getAnnotation(ConstructorProperties.class); if (cp != null) { String[] names = cp.value(); if (names.length != paramCount) { throw new IllegalStateException("Constructor annotated with @ConstructorProperties but not " + "corresponding to actual number of parameters (" + paramCount + "): " + candidate); } return names; } else { return null; } }
Example 5
Source File: ConstructorResolver.java From blog_demos with Apache License 2.0 | 5 votes |
public static String[] evaluate(Constructor<?> candidate, int paramCount) { ConstructorProperties cp = candidate.getAnnotation(ConstructorProperties.class); if (cp != null) { String[] names = cp.value(); if (names.length != paramCount) { throw new IllegalStateException("Constructor annotated with @ConstructorProperties but not " + "corresponding to actual number of parameters (" + paramCount + "): " + candidate); } return names; } else { return null; } }
Example 6
Source File: ConstructorResolver.java From spring4-understanding with Apache License 2.0 | 5 votes |
public static String[] evaluate(Constructor<?> candidate, int paramCount) { ConstructorProperties cp = candidate.getAnnotation(ConstructorProperties.class); if (cp != null) { String[] names = cp.value(); if (names.length != paramCount) { throw new IllegalStateException("Constructor annotated with @ConstructorProperties but not " + "corresponding to actual number of parameters (" + paramCount + "): " + candidate); } return names; } else { return null; } }
Example 7
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); } }