Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-2
-
Fix Version/s: 1.0-beta-2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
In webwork, we create a new XWorkPicoContainer for each request to handle request scoped components. As most actions will only need 1 or 2 components, it would be nice for the container to only instantiate the components that are required.
Our ideal usage would be
Object getComponent(Class componentType)
where componentType can a registered or unregistered component. unregistered components would need to follow pico rules (only 1 constructor) and each argument in the constructor would need to be a registered pico component.
Here's the code we're using now to do this:
public Object createAction(Class componentType) {
Constructor constructor = componentType.getConstructors()[0];
Class[] parameters = constructor.getParameterTypes();
Object[] args = new Object[parameters.length];
try {
for (int i = 0; i < parameters.length; i++)
return makeComponentInstance(componentType, constructor, args);
} catch (PicoInvocationTargetInitailizationException e)
return null;
}
Issue Links
- is related to
-
PICO-120 Default lifecycle should be a little more intelligent
Activity
Field | Original Value | New Value |
---|---|---|
Remaining Estimate | 0 minutes [ 0 ] | |
Original Estimate | 0 | |
Affects Version/s | 1.0-beta-1 [ 10144 ] | |
Fix Version/s | 1.0-beta-1 [ 10144 ] | |
Affects Version/s | 1.0-alpha-2 [ 10150 ] |
Fix Version/s | 1.0 [ 10145 ] | |
Fix Version/s | 1.0-beta-1 [ 10144 ] | |
Affects Version/s | 1.0 [ 10145 ] | |
Affects Version/s | 1.0-beta-1 [ 10144 ] |
Status | Unassigned [ 1 ] | Assigned [ 2 ] |
Assignee | Aslak Hellesoy [ rinkrank ] |
Status | Assigned [ 2 ] | In Progress [ 3 ] |
Affects Version/s | 1.0-beta-2 [ 10217 ] | |
Fix Version/s | 1.0 [ 10145 ] | |
Affects Version/s | 1.0 [ 10145 ] | |
Fix Version/s | 1.0-beta-2 [ 10217 ] |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |