|
@@ -13,7 +13,7 @@ |
13 |
13 |
|
private Map<Class<?>, Object> mInstanceByClass = new HashMap<Class<?>, Object>(); |
14 |
14 |
|
|
15 |
15 |
|
/** |
16 |
|
- |
* Get a List (!null) of all the currently "set" Factories |
|
16 |
+ |
* Get a List (!null) of all the currently "register" Factories |
17 |
17 |
|
*/ |
18 |
18 |
|
public synchronized List<NoInstanceFactory<?>> getNoInstanceFactories() { |
19 |
19 |
|
return new ArrayList<NoInstanceFactory<?>>( mFactoriesByClass.values() ); |
|
@@ -27,7 +27,7 @@ |
27 |
27 |
|
* @throws IllegalArgumentException if pFactory is null |
28 |
28 |
|
* @throws IllegalStateException if this is a duplicate Factory |
29 |
29 |
|
*/ |
30 |
|
- |
public void setNoInstanceFactory( NoInstanceFactory<?> pFactory ) { |
|
30 |
+ |
public void register( NoInstanceFactory<?> pFactory ) { |
31 |
31 |
|
Confirm.isNotNull( "NoInstanceFactory", pFactory ); |
32 |
32 |
|
Class<?> zClass = pFactory.getFor(); |
33 |
33 |
|
assertClass( zClass ); |
|
@@ -44,7 +44,7 @@ |
44 |
44 |
|
/** |
45 |
45 |
|
* @param pClass !null |
46 |
46 |
|
* |
47 |
|
- |
* @return null if not found or current instance set / replaced |
|
47 |
+ |
* @return null if not found or current instance register / replaced |
48 |
48 |
|
* |
49 |
49 |
|
* @throws IllegalArgumentException if pClass is null |
50 |
50 |
|
*/ |
|
@@ -58,7 +58,7 @@ |
58 |
58 |
|
} |
59 |
59 |
|
|
60 |
60 |
|
/** |
61 |
|
- |
* Get the previously 'registered' (set &/ replaced) instance of pClass. |
|
61 |
+ |
* Get the previously 'registered' (register &/ replaced) instance of pClass. |
62 |
62 |
|
* NOTE: if there is no instance currently registered, then one is attempted to be added using a previously registered NoInstanceFactory. |
63 |
63 |
|
* |
64 |
64 |
|
* @param pClass !null |
|
@@ -90,7 +90,7 @@ |
90 |
90 |
|
} |
91 |
91 |
|
|
92 |
92 |
|
/** |
93 |
|
- |
* Set or register an instance (pInstance) of pClass, that is NOT currently 'registered' (previously set &/ replaced, but not subsequently removed) |
|
93 |
+ |
* Set or register an instance (pInstance) of pClass, that is NOT currently 'registered' (previously register &/ replaced, but not subsequently removed) |
94 |
94 |
|
* |
95 |
95 |
|
* @param pClass !null |
96 |
96 |
|
* @param pInstance !null |
|
@@ -98,7 +98,7 @@ |
98 |
98 |
|
* @throws IllegalArgumentException if either pClass or pInstance is null |
99 |
99 |
|
* @throws IllegalStateException if an instance for pClass IS currently 'registered' |
100 |
100 |
|
*/ |
101 |
|
- |
public <T, V extends T> void set( Class<T> pClass, V pInstance ) |
|
101 |
+ |
public <T, V extends T> void register( Class<T> pClass, V pInstance ) |
102 |
102 |
|
throws IllegalArgumentException, IllegalStateException { |
103 |
103 |
|
assertClassAndInstance( pClass, pInstance ); |
104 |
104 |
|
synchronized ( this ) { |
|
@@ -112,7 +112,7 @@ |
112 |
112 |
|
} |
113 |
113 |
|
|
114 |
114 |
|
/** |
115 |
|
- |
* Replace or re-register an instance (pInstance) of pClass, that IS currently 'registered' (previously set &/ replaced, but not subsequently removed) |
|
115 |
+ |
* Replace or re-register an instance (pInstance) of pClass, that IS currently 'registered' (previously register &/ replaced, but not subsequently removed) |
116 |
116 |
|
* |
117 |
117 |
|
* @param pClass !null |
118 |
118 |
|
* @param pInstance !null |
|
@@ -120,7 +120,7 @@ |
120 |
120 |
|
* @throws IllegalArgumentException if either pClass or pInstance is null |
121 |
121 |
|
* @throws IllegalStateException if an instance for pClass is NOT currently 'registered' |
122 |
122 |
|
*/ |
123 |
|
- |
public <T, V extends T> void replace( Class<T> pClass, V pInstance ) |
|
123 |
+ |
public <T, V extends T> void forceRegister( Class<T> pClass, V pInstance ) |
124 |
124 |
|
throws IllegalArgumentException, IllegalStateException { |
125 |
125 |
|
assertClassAndInstance( pClass, pInstance ); |
126 |
126 |
|
synchronized ( this ) { |
|
@@ -130,11 +130,11 @@ |
130 |
130 |
|
return; |
131 |
131 |
|
} |
132 |
132 |
|
} |
133 |
|
- |
throw new IllegalStateException( "No instance to replace for: " + pClass ); |
|
133 |
+ |
throw new IllegalStateException( "No instance to forceRegister for: " + pClass ); |
134 |
134 |
|
} |
135 |
135 |
|
|
136 |
136 |
|
/** |
137 |
|
- |
* Remove the instance (pInstance) of pClass, that IS currently 'registered' (previously set &/ replaced, but not subsequently removed) |
|
137 |
+ |
* Remove the instance (pInstance) of pClass, that IS currently 'registered' (previously register &/ replaced, but not subsequently removed) |
138 |
138 |
|
* |
139 |
139 |
|
* @param pClass !null |
140 |
140 |
|
* @param pInstance !null |