Package org.drools.compiler.builder
Class AbstractResourceProcessor<T extends ProcessedResource>
java.lang.Object
org.drools.compiler.builder.AbstractResourceProcessor<T>
- All Implemented Interfaces:
ResourceProcessor<T>
public abstract class AbstractResourceProcessor<T extends ProcessedResource>
extends Object
implements ResourceProcessor<T>
A basic implementation of a
ResourceProcessor. This is the preferred way to
implement such interface.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidappendError(KnowledgeBuilderError error) Utility to append errors to the internal collection duringprocess()final Collection<? extends KnowledgeBuilderError>Returns any error that have been generated while processing the resource.final Tfinal Resourceabstract voidprocess()Implementations should always callappendError(KnowledgeBuilderError)to append errors that occur during processing, andsetProcessedResource(ProcessedResource)to return the result.protected final voidsetProcessedResource(T processedResource) Utility to set the result ofprocess().
-
Constructor Details
-
AbstractResourceProcessor
- Parameters:
resource- resource that will be processed
-
-
Method Details
-
process
public abstract void process()Implementations should always callappendError(KnowledgeBuilderError)to append errors that occur during processing, andsetProcessedResource(ProcessedResource)to return the result.- Specified by:
processin interfaceResourceProcessor<T extends ProcessedResource>
-
getResource
- Specified by:
getResourcein interfaceResourceProcessor<T extends ProcessedResource>- Returns:
- the resource that is processed by this object
-
appendError
Utility to append errors to the internal collection duringprocess() -
setProcessedResource
Utility to set the result ofprocess(). -
getProcessedResource
- Specified by:
getProcessedResourcein interfaceResourceProcessor<T extends ProcessedResource>- Returns:
- the processed resource or null if there were errors
-
getErrors
Description copied from interface:ResourceProcessorReturns any error that have been generated while processing the resource.- Specified by:
getErrorsin interfaceResourceProcessor<T extends ProcessedResource>- Returns:
- empty if no errors occurred and the resource have been successfully processed
-