use of com.google.inject.spi.Toolable in project guice by google.
the class FactoryProvider2 method initialize.
/**
* At injector-creation time, we initialize the invocation handler. At this time we make sure all
* factory methods will be able to build the target types.
*/
@Inject
@Toolable
void initialize(Injector injector) {
if (this.injector != null) {
throw new ConfigurationException(ImmutableList.of(new Message(FactoryProvider2.class, "Factories.create() factories may only be used in one Injector!")));
}
this.injector = injector;
for (Map.Entry<Method, AssistData> entry : assistDataByMethod.entrySet()) {
Method method = entry.getKey();
AssistData data = entry.getValue();
Object[] args;
if (!data.optimized) {
args = new Object[method.getParameterTypes().length];
Arrays.fill(args, "dummy object for validating Factories");
} else {
// won't be used -- instead will bind to data.providers.
args = null;
}
getBindingFromNewInjector(method, args, // throws if the binding isn't properly configured
data);
}
}
use of com.google.inject.spi.Toolable in project roboguice by roboguice.
the class FactoryProvider2 method initialize.
/**
* At injector-creation time, we initialize the invocation handler. At this time we make sure
* all factory methods will be able to build the target types.
*/
@Inject
@Toolable
void initialize(Injector injector) {
if (this.injector != null) {
throw new ConfigurationException(ImmutableList.of(new Message(FactoryProvider2.class, "Factories.create() factories may only be used in one Injector!")));
}
this.injector = injector;
for (Map.Entry<Method, AssistData> entry : assistDataByMethod.entrySet()) {
Method method = entry.getKey();
AssistData data = entry.getValue();
Object[] args;
if (!data.optimized) {
args = new Object[method.getParameterTypes().length];
Arrays.fill(args, "dummy object for validating Factories");
} else {
// won't be used -- instead will bind to data.providers.
args = null;
}
// throws if the binding isn't properly configured
getBindingFromNewInjector(method, args, data);
}
}
Aggregations