private String getFieldName(InjectionPoint ip) { Annotated annotated = ip.getAnnotated(); if (annotated instanceof AnnotatedField) { AnnotatedField f = (AnnotatedField) annotated; return f.getJavaMember().getName(); } if (annotated instanceof AnnotatedParameter) { AnnotatedParameter p = (AnnotatedParameter) annotated; Member member = ip.getMember(); if (member instanceof Method) { return member.getName() + "_" + p.getPosition(); } if (member instanceof Constructor) { return "new_" + p.getPosition(); } } return ip.getMember().getName(); }
@SuppressWarnings("Duplicates") private String getFieldName(InjectionPoint ip) { Annotated annotated = ip.getAnnotated(); if (annotated instanceof AnnotatedField) { AnnotatedField<?> f = (AnnotatedField<?>) annotated; return f.getJavaMember().getName(); } if (annotated instanceof AnnotatedParameter) { AnnotatedParameter<?> p = (AnnotatedParameter<?>) annotated; Member member = ip.getMember(); if (member instanceof Method) { return member.getName() + "_" + p.getPosition(); } if (member instanceof Constructor) { return "new_" + p.getPosition(); } } return ip.getMember().getName(); }
/** * Get the underlying {@link Parameter}. * * @return the {@link Parameter} */ default Parameter getJavaParameter() { Member member = getDeclaringCallable().getJavaMember(); if (!(member instanceof Executable)) { throw new IllegalStateException("Parameter does not belong to an executable: " + member); } Executable executable = (Executable) member; return executable.getParameters()[getPosition()]; }
public AnnotatedParameterImpl(AnnotatedParameter<? super T> param, Set<Annotation> annotations, AnnotatedCallable<T> declaringCallable) { this(param.getBaseType(), param.getTypeClosure(), annotations, declaringCallable, param.getPosition()); }
public static void validateAnnotatedParameter(AnnotatedParameter<?> parameter) { validateAnnotated(parameter); if (parameter.getPosition() < 0) { throw MetadataLogger.LOG.invalidParameterPosition(parameter.getPosition(), parameter); } checkNotNull(parameter.getDeclaringCallable(), "getDeclaringCallable()", parameter); }
/** * Compares two annotated parameters and returns true if they are equal */ public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) { return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2); }
public AnnotatedParameterImpl(AnnotatedParameter<? super T> param, Set<Annotation> annotations, AnnotatedCallable<T> declaringCallable) { this(param.getBaseType(), param.getTypeClosure(), annotations, declaringCallable, param.getPosition()); }
/** * Compares two annotated parameters and returns true if they are equal */ public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) { return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2); }
/** * Compares two annotated parameters and returns true if they are equal */ public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) { return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2); }
public static void validateAnnotatedParameter(AnnotatedParameter<?> parameter) { validateAnnotated(parameter); if (parameter.getPosition() < 0) { throw MetadataLogger.LOG.invalidParameterPosition(parameter.getPosition(), parameter); } checkNotNull(parameter.getDeclaringCallable(), "getDeclaringCallable()", parameter); }
public static void validateAnnotatedParameter(AnnotatedParameter<?> parameter) { validateAnnotated(parameter); if (parameter.getPosition() < 0) { throw MetadataLogger.LOG.invalidParameterPosition(parameter.getPosition(), parameter); } checkNotNull(parameter.getDeclaringCallable(), "getDeclaringCallable()", parameter); }
public AnnotatedParameterImpl(AnnotatedParameter<? super T> param, AnnotatedCallable<T> declaringCallable) { this(param.getBaseType(), param.getTypeClosure(), param.getAnnotations(), declaringCallable, param.getPosition()); }
private int initDelegateInjectionPointPosition() { for (ParameterInjectionPoint<?, T> parameter : getParameterInjectionPoints()) { if (parameter.isDelegate()) { return parameter.getAnnotated().getPosition(); } } return -1; }
private int initDelegateInjectionPointPosition() { for (ParameterInjectionPoint<?, T> parameter : getParameterInjectionPoints()) { if (parameter.isDelegate()) { return parameter.getAnnotated().getPosition(); } } return -1; }
public UnbackedAnnotatedConstructor(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Constructor<X> constructor, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.constructor = constructor; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = immutableListView(parameters); }
public UnbackedAnnotatedMethod(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Method method, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.method = method; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public UnbackedAnnotatedConstructor(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Constructor<X> constructor, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.constructor = constructor; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public UnbackedAnnotatedMethod(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Method method, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.method = method; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public UnbackedAnnotatedConstructor(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Constructor<X> constructor, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.constructor = constructor; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public UnbackedAnnotatedMethod(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Method method, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.method = method; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = immutableListView(parameters); }