@Override public MutablePicoContainer addComponent(final Object key, final Object implOrInstance, final Parameter... parameters) throws PicoCompositionException { return DefaultPicoContainer.this.addComponent(key, implOrInstance, properties, new ConstructorParameters(parameters), null, null); }
/** * Expect any scalar parameter of the appropriate type or the collecting type * {@link java.lang.reflect.Array},{@link java.util.Collection}or {@link java.util.Map}. * The components in the collection will be of the specified type. * * @param componentValueType the component's type (ignored for an Array) * @param emptyCollection <code>true</code> allows the collection to be empty */ public ComponentParameter(final Generic<?> componentValueType, final boolean emptyCollection) { this(null, new CollectionComponentParameter(componentValueType, emptyCollection)); }
private boolean isDefaultParameter(final Parameter parameter) { if (parameter == ComponentParameter.DEFAULT || parameter == JSR330ComponentParameter.DEFAULT) { return true; } if (parameter instanceof ComponentParameter) { return !((ComponentParameter) parameter).isKeyDefined(); } return false; }
private static Parameter toParameter(final Object obj) { return obj instanceof Parameter ? (Parameter) obj : new ConstantParameter(obj); }
public BeanParameters(final String name, final Parameter... params) { super(convertPropertyNameToSetterName(name), params); }
public boolean isResolved() { return parameter != null && parameter.getParams() != null; }
protected boolean isAssignable(final Type expectedType) { if (expectedType instanceof Class) { Class<?> expectedClass = (Class<?>) expectedType; if (checkPrimitive(expectedClass) || expectedClass.isInstance(value)) { return true; } } return false; }
/** * {@inheritDoc} * @see com.picocontainer.Parameter#resolve(com.picocontainer.PicoContainer, com.picocontainer.ComponentAdapter, com.picocontainer.ComponentAdapter, java.lang.reflect.Type, com.picocontainer.NameBinding, boolean, java.lang.annotation.Annotation) */ public Resolver resolve(final PicoContainer container, final ComponentAdapter<?> forAdapter, final ComponentAdapter<?> injecteeAdapter, final Type expectedType, final NameBinding expectedNameBinding, final boolean useNames, final Annotation binding) { return new ValueResolver(isAssignable(expectedType), null, null); }
private void throwCompositionException(final Class<?> impl, final AccessibleObjectParameterSet eachParam) { throw new PicoCompositionException("Cannot locate field or method '" + eachParam.getName() + "' in type " + impl + ". \n\tParameter in error: " + eachParam); }
/*** * Convenience method that allows creation of a constructor injector with specific, optional parameters. * @param key * @param impl * @param params */ public ConstructorInjector(final Object key, final Class<T> impl, final Parameter... params) { this(key, impl, (params == null || params.length == 0) ? (ConstructorParameters)null : new ConstructorParameters(params)); }
/** * Expect any scalar parameter of the appropriate type or the collecting type * {@link java.lang.reflect.Array},{@link java.util.Collection}or {@link java.util.Map}. * The components in the collection will be of the specified type. * * @param componentValueType the component's type (ignored for an Array) * @param emptyCollection <code>true</code> allows the collection to be empty */ public ComponentParameter(final Generic<?> componentValueType, final boolean emptyCollection) { this(null, new CollectionComponentParameter(componentValueType, emptyCollection)); }
public BeanParameters(final Class<?> targetType, final String name, final Parameter... params) { super(targetType, convertPropertyNameToSetterName(name), params); }
private boolean isDefaultParameter(final Parameter parameter) { if (parameter == ComponentParameter.DEFAULT || parameter == JSR330ComponentParameter.DEFAULT) { return true; } if (parameter instanceof ComponentParameter) { return !((ComponentParameter) parameter).isKeyDefined(); } return false; }
public boolean isResolved() { return parameter != null && parameter.getParams() != null; }
/*** * Convenience method that allows creation of a constructor injector with specific, optional parameters. * @param key * @param impl * @param params */ public ConstructorInjector(final Object key, final Class<T> impl, final Parameter... params) { this(key, impl, (params == null || params.length == 0) ? (ConstructorParameters)null : new ConstructorParameters(params)); }
/** * Expect any scalar parameter of the appropriate type or the collecting type * {@link java.lang.reflect.Array},{@link java.util.Collection}or {@link java.util.Map}. * The components in the collection will be of the specified type and their adapter's key * must have a particular type. * * @param keyType the component adapter's key type * @param componentValueType the component's type (ignored for an Array) * @param emptyCollection <code>true</code> allows the collection to be empty */ public ComponentParameter(final Class<?> keyType, final Generic<?> componentValueType, final boolean emptyCollection) { this(null, new CollectionComponentParameter(keyType, componentValueType, emptyCollection)); }
public BeanParameters(final Class<?> targetType, final String name, final Parameter... params) { super(targetType, convertPropertyNameToSetterName(name), params); }
@Override public MutablePicoContainer addComponent(final Object key, final Object implOrInstance, final Parameter... parameters) throws PicoCompositionException { return DefaultPicoContainer.this.addComponent(key, implOrInstance, properties, new ConstructorParameters(parameters), null, null); }
/** * Expect any scalar parameter of the appropriate type or the collecting type * {@link java.lang.reflect.Array},{@link java.util.Collection}or {@link java.util.Map}. * The components in the collection will be of the specified type and their adapter's key * must have a particular type. * * @param keyType the component adapter's key type * @param componentValueType the component's type (ignored for an Array) * @param emptyCollection <code>true</code> allows the collection to be empty */ public ComponentParameter(final Class<?> keyType, final Generic<?> componentValueType, final boolean emptyCollection) { this(null, new CollectionComponentParameter(keyType, componentValueType, emptyCollection)); }
public BeanParameters(final String name, final Parameter... params) { super(convertPropertyNameToSetterName(name), params); }