use of org.openksavi.sponge.ProcessorAdapter in project sponge by softelnet.
the class DefaultProcessorManager method createAdapter.
protected BaseProcessorAdapter createAdapter(ProcessorInstanceHolder instanceHolder, ProcessorType requiredType) {
Processor processor = instanceHolder.getProcessor();
Validate.isInstanceOf(ProcessorAdapterFactory.class, processor, "Processor must implement %s", ProcessorAdapterFactory.class);
ProcessorAdapter adapter = ((ProcessorAdapterFactory) processor).createAdapter();
Validate.isInstanceOf(BaseProcessorAdapter.class, adapter, "Processor adapter must extend %s", BaseProcessorAdapter.class);
BaseProcessorAdapter result = (BaseProcessorAdapter) adapter;
result.getDefinition().setJavaDefined(instanceHolder.isJavaDefined());
result.getDefinition().setProcessorClass(processor.getClass());
if (requiredType != null) {
Validate.isTrue(adapter.getType() == requiredType, "% is % but should be %", adapter.getName(), adapter.getType().getDisplayName(), requiredType.getDisplayName());
}
return result;
}
Aggregations