@Override public AnnotatedConstructor withAnnotations(AnnotationMap ann) { return new AnnotatedConstructor(_constructor, ann, _paramAnnotations); }
/** * @param addParamAnnotations Whether parameter annotations are to be * added as well */ protected void _addMixOvers(Constructor<?> mixin, AnnotatedConstructor target, boolean addParamAnnotations) { for (Annotation a : mixin.getDeclaredAnnotations()) { if (_annotationIntrospector.isHandled(a)) { target.addOrOverride(a); } } if (addParamAnnotations) { Annotation[][] pa = mixin.getParameterAnnotations(); for (int i = 0, len = pa.length; i < len; ++i) { for (Annotation a : pa[i]) { target.addOrOverrideParam(i, a); } } } }
ac.fixAccess(); return ac.getAnnotated().newInstance(); } catch (Exception e) { Throwable t = e;
/** * Method that can be called to locate a single-arg constructor that * takes specified exact type (will not accept supertype constructors) * * @param argTypes Type(s) of the argument that we are looking for */ public Constructor<?> findSingleArgConstructor(Class<?>... argTypes) { for (AnnotatedConstructor ac : _classInfo.getConstructors()) { // This list is already filtered to only include accessible /* (note: for now this is a redundant check; but in future * that may change; thus leaving here for now) */ if (ac.getParameterCount() == 1) { Class<?> actArg = ac.getParameterClass(0); for (Class<?> expArg : argTypes) { if (expArg == actArg) { return ac.getAnnotated(); } } } } return null; }
_creatorProperties = new LinkedList<POJOPropertyBuilder>(); for (int i = 0, len = ctor.getParameterCount(); i < len; ++i) { AnnotatedParameter param = ctor.getParameter(i); String name = ai.findPropertyNameForParam(param);
int argCount = ctor.getParameterCount(); if (argCount < 1) { continue; String name = intr.findPropertyNameForParam(ctor.getParameter(0)); if (name == null || name.length() == 0) { // not property based Class<?> type = ctor.getParameterClass(0); if (type == String.class) { if (autodetect || isCreator) { AnnotatedParameter param = ctor.getParameter(i); String name = (param == null) ? null : intr.findPropertyNameForParam(param);
protected void _addConstructorMixIns(Class<?> mixin) { MemberKey[] ctorKeys = null; int ctorCount = (_constructors == null) ? 0 : _constructors.size(); for (Constructor<?> ctor : mixin.getDeclaredConstructors()) { if (ctor.getParameterTypes().length == 0) { if (_defaultConstructor != null) { _addMixOvers(ctor, _defaultConstructor, false); } } else { if (ctorKeys == null) { ctorKeys = new MemberKey[ctorCount]; for (int i = 0; i < ctorCount; ++i) { ctorKeys[i] = new MemberKey(_constructors.get(i).getAnnotated()); } } MemberKey key = new MemberKey(ctor); for (int i = 0; i < ctorCount; ++i) { if (!key.equals(ctorKeys[i])) { continue; } _addMixOvers(ctor, _constructors.get(i), true); break; } } } }
AnnotatedParameter param = ctor.getParameter(0); String name = intr.findPropertyNameForParam(param); Object injectId = intr.findInjectableValueId(param); Class<?> type = ctor.getParameterClass(0); if (type == String.class) { if (isCreator || isVisible) {
@Override public String toString() { return "[constructor for "+getName()+", annotations: "+_annotations+"]"; } }
public Delegating(AnnotatedConstructor ctor, AnnotatedMethod factory) { if (ctor != null) { _ctor = ctor.getAnnotated(); _factoryMethod = null; _valueType = TypeFactory.type(ctor.getParameterType(0)); } else if (factory != null) { _ctor = null; _factoryMethod = factory.getAnnotated(); _valueType = TypeFactory.type(factory.getParameterType(0)); } else { throw new IllegalArgumentException("Internal error: neither delegating constructor nor factory method passed"); } }
@Override public Type getGenericType() { return getRawType(); }
/** * Method that can be called to locate a single-arg constructor that * takes specified exact type (will not accept supertype constructors) * * @param argTypes Type(s) of the argument that we are looking for */ public Constructor<?> findSingleArgConstructor(Class<?>... argTypes) { for (AnnotatedConstructor ac : _classInfo.getConstructors()) { // This list is already filtered to only include accessible /* (note: for now this is a redundant check; but in future * that may change; thus leaving here for now) */ if (ac.getParameterCount() == 1) { Class<?> actArg = ac.getParameterClass(0); for (Class<?> expArg : argTypes) { if (expArg == actArg) { return ac.getAnnotated(); } } } } return null; }
int argCount = ctor.getParameterCount(); if (argCount < 1) { continue; CreatorProperty[] properties = new CreatorProperty[argCount]; for (int i = 0; i < argCount; ++i) { AnnotatedParameter param = ctor.getParameter(i); String name = (param == null) ? null : intr.findPropertyNameForParam(param); Object injectId = intr.findInjectableValueId(param);
int argCount = ctor.getParameterCount(); if (argCount < 1) { continue; AnnotatedParameter param = ctor.getParameter(0); String name = intr.findPropertyNameForParam(param); if (name == null || name.length() == 0) { // not property based Class<?> type = ctor.getParameterClass(0); if (type == String.class) { if (isCreator || isVisible) { SettableBeanProperty[] properties = new SettableBeanProperty[argCount]; for (int i = 0; i < argCount; ++i) { AnnotatedParameter param = ctor.getParameter(i); String name = (param == null) ? null : intr.findPropertyNameForParam(param);
if (defaultCtor != null) { if (fixAccess) { ClassUtil.checkAndFixAccess(defaultCtor.getAnnotated());
AnnotatedParameter param = ctor.getParameter(0); String name = intr.findPropertyNameForParam(param); Object injectId = intr.findInjectableValueId(param); Class<?> type = ctor.getParameterClass(0); if (type == String.class) { if (isCreator || isVisible) {
@Override public String toString() { return "[constructor for "+getName()+", annotations: "+_annotations+"]"; } }
public Delegating(BasicBeanDescription beanDesc, AnnotatedConstructor ctor, AnnotatedMethod factory) { TypeBindings bindings = beanDesc.bindingsForBeanType(); if (ctor != null) { _creator = ctor; _ctor = ctor.getAnnotated(); _factoryMethod = null; _valueType = bindings.resolveType(ctor.getParameterType(0)); } else if (factory != null) { _creator = factory; _ctor = null; _factoryMethod = factory.getAnnotated(); _valueType = bindings.resolveType(factory.getParameterType(0)); } else { throw new IllegalArgumentException("Internal error: neither delegating constructor nor factory method passed"); } }
@Override public Type getGenericType() { return getRawType(); }
/** * Method that can be called to locate a single-arg constructor that * takes specified exact type (will not accept supertype constructors) * * @param argTypes Type(s) of the argument that we are looking for */ public Constructor<?> findSingleArgConstructor(Class<?>... argTypes) { for (AnnotatedConstructor ac : _classInfo.getConstructors()) { // This list is already filtered to only include accessible /* (note: for now this is a redundant check; but in future * that may change; thus leaving here for now) */ if (ac.getParameterCount() == 1) { Class<?> actArg = ac.getParameterClass(0); for (Class<?> expArg : argTypes) { if (expArg == actArg) { return ac.getAnnotated(); } } } } return null; }