/trunk/src/main/java/org/mentacontainer/ConfigurableComponent.java |
---|
File deleted |
\ No newline at end of file |
/trunk/src/main/java/org/mentacontainer/impl/MentaComponent.java |
---|
8,7 → 8,7 |
import java.util.List; |
import java.util.Map; |
import org.mentacontainer.ConfigurableComponent; |
import org.mentacontainer.Component; |
import org.mentacontainer.util.FindMethod; |
/** |
16,7 → 16,7 |
* |
* @author sergio.oliveira.jr@gmail.com |
*/ |
public class MentaComponent implements ConfigurableComponent { |
public class MentaComponent implements Component { |
private final Class<? extends Object> klass; |
46,7 → 46,7 |
public boolean isSingleton() { return singleton; } |
public ConfigurableComponent addProperty(String name, Object value) { |
public Component addProperty(String name, Object value) { |
if (props == null) { |
60,7 → 60,7 |
return this; |
} |
public ConfigurableComponent addInitValue(Object value) { |
public Component addInitValue(Object value) { |
if (initValues == null) { |
/trunk/src/main/java/org/mentacontainer/impl/MentaContainer.java |
---|
7,7 → 7,6 |
import java.util.Set; |
import org.mentacontainer.Component; |
import org.mentacontainer.ConfigurableComponent; |
import org.mentacontainer.Container; |
import org.mentacontainer.Dependency; |
import org.mentacontainer.util.InjectionUtils; |
119,22 → 118,14 |
return component; |
} |
public ConfigurableComponent ioc(String key, Class<? extends Object> klass) { |
public Component ioc(String key, Class<? extends Object> klass) { |
ConfigurableComponent cc = new MentaComponent(klass); |
ioc(key, cc); |
return cc; |
return ioc(key, new MentaComponent(klass)); |
} |
public ConfigurableComponent ioc(String key, Class<? extends Object> klass, boolean singleton) { |
public Component ioc(String key, Class<? extends Object> klass, boolean singleton) { |
ConfigurableComponent cc = new MentaComponent(klass, singleton); |
ioc(key, cc); |
return cc; |
return ioc(key, new MentaComponent(klass, singleton)); |
} |
public Dependency autowire(Dependency d) { |
/trunk/src/main/java/org/mentacontainer/Component.java |
---|
1,7 → 1,8 |
package org.mentacontainer; |
/** |
* An IoC component that knows how to create instances of itself. |
* An IoC component that knows how to create instances of itself and accepts init values for its constructor |
* and properties to be injected through its setters. |
* |
* @author sergio.oliveira.jr@gmail.com |
*/ |
15,6 → 16,24 |
public <T> T getInstance(); |
/** |
* Add a constructor parameter to be used when the bean is instantiated. It can be called more than once to |
* use constructors with more than one argument. |
* |
* @param value A parameter value to be used by a constructor. |
* @return The component itself. (Fluent API) |
*/ |
public Component addInitValue(Object value); |
/** |
* Add a property to be injected through a setter when the component is instantiated. |
* |
* @param name The property name. |
* @param value The property value. |
* @return The component itself. (Fluent API) |
*/ |
public Component addProperty(String name, Object value); |
/** |
* Is this component a singleton component, in other words, |
* it always returns the same instance? |
* |
/trunk/src/main/java/org/mentacontainer/Container.java |
---|
35,9 → 35,9 |
* @param key The key representing the bean to return. The name of the bean in the container. |
* @param klass The class used to instantiate the bean, in other words, its implementation. |
* @param singleton A boolean to indicate if this bean will be a singleton. |
* @return The component created as a ConfigurableComponent. (Fluent API) |
* @return The component created. (Fluent API) |
*/ |
public ConfigurableComponent ioc(String key, Class<? extends Object> klass, boolean singleton); |
public Component ioc(String key, Class<? extends Object> klass, boolean singleton); |
/** |
* Same as {@link #ioc(String, Class, boolean)} except that it assumes |
45,16 → 45,16 |
* |
* @param key |
* @param klass |
* @return The component created as a ConfigurableComponent. (Fluent API) |
* @return The component created. (Fluent API) |
*/ |
public ConfigurableComponent ioc(String key, Class<?extends Object> klass); |
public Component ioc(String key, Class<?extends Object> klass); |
/** |
* Set up IoC based on the component passed. |
* |
* @param key The key representing the bean to return. The name of the bean in the container. |
* @param component The component for the IoC. |
* @return The component passed as a parameter. |
* @return The component passed as a parameter. (Fluent API) |
* @see Component |
*/ |
public Component ioc(String key, Component component); |