import org.wamblee.system.core.RequiredInterface;
import org.wamblee.system.core.Scope;
+/**
+ * A Class Adapter adapts a given class to a Component.
+ *
+ * @author Erik Brakkee
+ */
public class ClassAdapter extends AbstractComponent<Object> {
private ClassConfiguration _classConfig;
/**
* The class configuration encapsulates the knowledge of how to wrap a class as a component.
- * In particular, it provides:
- * <ul>
- * <li> Selection of a constructor using explicit selection
- * {@link #select(Class...)} or using the most greedy constructor
- * {@link #greedy()}.
- * </li>
- * <li>
- * Selection of methods to invoke to inject other objects into the object.
- * </li>
- * <li> Selection of fields to set.
- * </li>
- * </ul>
*
* @author Erik Brakkee
*
import org.wamblee.system.core.Scope;
import org.wamblee.system.core.SystemAssemblyException;
+/**
+ * Class that allows configuration of the constructor to use.
+ *
+ * In particular, it provides:
+ * <ul>
+ * <li> Selection of a constructor using explicit selection
+ * {@link #select(Class...)} or using the most greedy constructor
+ * {@link #greedy()}.
+ * </li>
+ * <li>
+ * Selection of methods to invoke to inject other objects into the object.
+ * </li>
+ * <li> Selection of fields to set.
+ * </li>
+ * </ul>
+ */
public class ConstructorConfiguration {
private Class _class;
private Constructor<?> _constructor;
private boolean _publicOnly;
/**
- * Constructs the configuration. By default no constructor is selected and
- * one of {@link #select(Class...)} or
- * {@link #greedy()} must be called.
+ * Constructs the configuration. By default the public constructor with the
+ * most arguments will be used.
* @param aClass Class to construct.
*/
public ConstructorConfiguration(Class aClass) {
/**
* Sets whether or no non public constructors are also considered.
- * Reset the choice of a constructor.
+ * Reset the choice of a constructor to its default.
* @param aNonPublic
* @return
*/
import org.wamblee.system.core.Scope;
+/**
+ * Value provider that provides a fixed value.
+ *
+ * @author Erik Brakkee
+ */
public class FixedValueProvider implements ValueProvider {
private Object _value;
+ /**
+ * Constructs the value.
+ * @param aValue Value to construct.
+ */
public FixedValueProvider(Object aValue) {
_value = aValue;
}
import org.wamblee.system.core.RequiredInterface;
import org.wamblee.system.core.Scope;
+/**
+ * Represents parameter values for a method or constructor and allows for the configuration
+ * of how these values are retrieved.
+ *
+ * @author Erik Brakkee
+ */
public class ParameterValues {
private Class[] _types;
private ValueProvider[] _values;
import org.wamblee.system.core.RequiredInterface;
import org.wamblee.system.core.Scope;
+/**
+ * Value provider that provides a value through a required interface.
+ *
+ * @author Erik Brakkee
+ */
public class RequiredInterfaceProvider implements ValueProvider {
private RequiredInterface _required;
+ /**
+ * Constructs the provider
+ * @param aRequired Required interface.
+ */
public RequiredInterfaceProvider(RequiredInterface aRequired) {
_required = aRequired;
}
import org.wamblee.system.core.Scope;
+/**
+ * Interface used to provide values for arguments of methods and constructors.
+ *
+ * @author Erik Brakkee
+ */
public interface ValueProvider {
Object getValue(Scope aScope);