It allows to register a special variable processor which can process some special global variables

@param processor a variable processor to be registered, it must not be null
@see SpecialVariableProcessor
977824
public void registerSpecialVariableProcessor(@Nonnull final SpecialVariableProcessor processor) {
    assertNotNull("Processor is null", processor);

    for (final String varName : processor.getVariableNames()) {
      assertNotNull("A Special Var name is null", varName);
      if (mapVariableNameToSpecialVarProcessor.containsKey(varName)) {
        throw new IllegalStateException("There is already defined processor for " + varName);
      }
      mapVariableNameToSpecialVarProcessor.put(varName, processor);
    }
  }
241548
public function process($processor) {
        if (!$processor instanceof base_processor) { // No correct processor, throw exception
            throw new base_element_struct_exception('incorrect_processor');
        }

        $iterator = $this->get_iterator($processor); // Get the iterator over backup-able data

        $itcounter = 0; // To check that the iterator only has 1 ocurrence
        foreach ($iterator as $key => $values) { // Process each "ocurrrence" of the nested element (recordset or array)

            // Fill the values of the attributes and final elements with the $values from the iterator
            $this->fill_values($values);

            // Delegate the process of each final_element
            foreach ($this->get_final_elements() as $final_element) {
                $final_element->process($processor);
            }

            // Everything processed, clean values before next iteration
            $this->clean_values();

            // Increment counters for this element
            $this->counter++;
            $itcounter++;

            // optigroup_element, check we only have 1 element always
            if ($itcounter > 1) {
                throw new base_element_struct_exception('optigroup_element_only_one_ocurrence', $this->get_name());
            }
        }
        // Close the iterator (DB recordset / array iterator)
        $iterator->close();
    }
1354037
public void parseAndProcess(
            final TemplateSpec templateSpec,
            final IContext context,
            final Writer writer) {

        Validate.notNull(templateSpec, "Template Specification cannot be null");
        Validate.notNull(context, "Context cannot be null");
        Validate.notNull(writer, "Writer cannot be null");


        // TemplateSpec will already have validated its contents, so need to do it here (template selectors,
        // resolution attributes, etc.)

        final String template = templateSpec.getTemplate();
        final Set<String> templateSelectors = templateSpec.getTemplateSelectors();
        final TemplateMode templateMode = templateSpec.getTemplateMode();
        final Map<String, Object> templateResolutionAttributes = templateSpec.getTemplateResolutionAttributes();

        final TemplateCacheKey cacheKey =
                    new TemplateCacheKey(
                            null, // ownerTemplate
                            template, templateSelectors,
                            0, 0, // lineOffset, colOffset
                            templateMode,
                            templateResolutionAttributes);


        /*
         * First look at the cache - it might be already cached
         */
        if (this.templateCache != null) {

            final TemplateModel cached =  this.templateCache.get(cacheKey);

            if (cached != null) {

                final IEngineContext engineContext =
                        EngineContextManager.prepareEngineContext(this.configuration, cached.getTemplateData(), templateResolutionAttributes, context);

                /*
                 * Create the handler chain to process the data.
                 * This is PARSE + PROCESS, so its called from the TemplateEngine, and the only case in which we should apply
                 * both pre-processors and post-processors (besides creating a last output-to-writer step)
                 */
                final ProcessorTemplateHandler processorTemplateHandler = new ProcessorTemplateHandler();
                final ITemplateHandler processingHandlerChain =
                        createTemplateProcessingHandlerChain(engineContext, true, true, processorTemplateHandler, writer);

                cached.process(processingHandlerChain);

                EngineContextManager.disposeEngineContext(engineContext);

                return;

            }

        }


        /*
         * Resolve the template
         */
        final TemplateResolution templateResolution =
                resolveTemplate(this.configuration, null, template, templateResolutionAttributes, true);


        /*
         * Build the TemplateData object
         */
        final TemplateData templateData =
                buildTemplateData(templateResolution, template, templateSelectors, templateMode, true);


        /*
         * Prepare the context instance that corresponds to this execution of the template engine
         */
        final IEngineContext engineContext =
                EngineContextManager.prepareEngineContext(this.configuration, templateData, templateResolutionAttributes, context);


        /*
         * Create the handler chain to process the data.
         * This is PARSE + PROCESS, so its called from the TemplateEngine, and the only case in which we should apply
         * both pre-processors and post-processors (besides creating a last output-to-writer step)
         */
        final ProcessorTemplateHandler processorTemplateHandler = new ProcessorTemplateHandler();
        final ITemplateHandler processingHandlerChain =
                createTemplateProcessingHandlerChain(engineContext, true, true, processorTemplateHandler, writer);


        /*
         * Obtain the parser
         */
        final ITemplateParser parser = getParserForTemplateMode(engineContext.getTemplateMode());


        /*
         * If the resolved template is cacheable, so we will first read it as an object, cache it, and then process it
         */
        if (templateResolution.getValidity().isCacheable() && this.templateCache != null) {

            // Create the handler chain to create the Template object
            final ModelBuilderTemplateHandler builderHandler = new ModelBuilderTemplateHandler(this.configuration, templateData);

            // Process the template into a TemplateModel
            parser.parseStandalone(
                    this.configuration,
                    null, template, templateSelectors, templateData.getTemplateResource(),
                    engineContext.getTemplateMode(), templateResolution.getUseDecoupledLogic(), builderHandler);

            // Obtain the TemplateModel
            final TemplateModel templateModel = builderHandler.getModel();

            // Put the new template into cache
            this.templateCache.put(cacheKey, templateModel);

            // Process the read (+cached) template itself
            templateModel.process(processingHandlerChain);

        } else {

            //  Process the template, which is not cacheable (so no worry about caching)
            parser.parseStandalone(
                    this.configuration,
                    null, template, templateSelectors, templateData.getTemplateResource(),
                    engineContext.getTemplateMode(), templateResolution.getUseDecoupledLogic(),  processingHandlerChain);

        }


        /*
         * Dispose the engine context now that processing has been done
         */
        EngineContextManager.disposeEngineContext(engineContext);


    }
961349
function(processors) {
        var that = this;
        _.each(processors, function(processor, name) {
            if (name in that._processors) {
                throw new Error('Processor "' + name + '" already exists!');
            }
            that._processors[name] = processor;
        });

        return this;
    }
1372096
def add_processor(self, processor_instance: Processor, priority=0) -> None:
        
        assert issubclass(processor_instance.__class__, Processor)
        processor_instance.priority = priority
        processor_instance.world = self
        self._processors.append(processor_instance)
        self._processors.sort(key=lambda proc: proc.priority, reverse=True)
1364529
@Override
	public Processor newProcessor(Processor sourceProcessor) {
		LocalLearnerProcessor newProcessor = new LocalLearnerProcessor();
		LocalLearnerProcessor originProcessor = (LocalLearnerProcessor) sourceProcessor;

		if (originProcessor.getLearner() != null){
			newProcessor.setLearner(originProcessor.getLearner().create());
		}

		if (originProcessor.getChangeDetector() != null){
				newProcessor.setChangeDetector(originProcessor.getChangeDetector());
		}

		newProcessor.setOutputStream(originProcessor.getOutputStream());
		return newProcessor;
	}
466154
public <A extends Annotation> void registerProcessor(final Class<A> annoClass, final FieldProcessor<A> processor) {
        ArgUtils.notNull(annoClass, "annoClass");
        ArgUtils.notNull(processor, "processor");
        
        pocessorMap.put(annoClass, processor);
        
    }
1241856
@NonNull
    public IconicsAnimatedDrawable processors(@NonNull IconicsAnimationProcessor... processors) {
        if (processors == null || processors.length == 0) return this;
        for (IconicsAnimationProcessor processor : processors) {
            processor(processor);
        }
        return this;
    }
330158
def register_default_processors(cls, frontend_editing=None):
        
        super(Page, cls).register_default_processors()

        if frontend_editing:
            cls.register_request_processor(
                edit_processors.frontendediting_request_processor,
                key='frontend_editing')
            cls.register_response_processor(
                edit_processors.frontendediting_response_processor,
                key='frontend_editing')
454254
function callProcessor(eventType, data, callback) {
    var p = processors[eventType];
    // no processors
    if (p===undefined || p.length==0) {
      if (callback!==undefined) callback(data);
      return;
    }
    // now go through all processors
    var n = 0;
    var cbCalled = false;
    var cb = function(inData) {
      if (cbCalled) throw new Error("Internal error in "+eventType+" processor. Callback is called TWICE.");
      cbCalled = true;
      if (n < p.length) {
        cbCalled = false;
        p[n++](inData, cb);
      } else {
        if (callback!==undefined) callback(inData);
      }
    };
    cb(data);
  }
106755
protected void addConfiguredProcessorParam(final ProcessorParam param) throws NullPointerException, BuildException {
    if (param == null) {
      throw new NullPointerException("param");
    }
    if (isReference()) {
      throw noChildrenAllowed();
    }
    this.processorParams.addElement(param);
  }
218789
public List<ConfigMessage> init(Processor processor) {
        List<ConfigMessage> configMessages = new ArrayList<>();

        if (action.getPredicate() != null) {
            try {
                predicate = ExpressionHandlerFactory.getHandler(action.getPredicate());

                predicate.init(processor, getAction(), true);

                if (!isUsesHeaders()) {
                    setUsesHeaders(predicate.isUsesHeaders());
                }
                if (!isUsesContent()) {
                    setUsesContent(predicate.isUsesContent());
                }

            } catch (Throwable t) {
                log.severe("Failed to initialise predicate for action:" + action, t);
                ConfigMessage configMessage = new ConfigMessage();
                configMessage.setSeverity(Severity.Error);
                configMessage.setMessage(t.getMessage());
                configMessage.setProcessor(processor.getDescription());
                configMessage.setAction(action.getDescription());
                configMessages.add(configMessage);
            }
        }

        return configMessages;
    }
554541
public static void writeProcessorOutputToValues(
            final Object output,
            final Processor<?, ?> processor,
            final Values values) {
        Map<String, String> mapper = processor.getOutputMapperBiMap();
        if (mapper == null) {
            mapper = Collections.emptyMap();
        }

        final Collection<Field> fields = getAllAttributes(output.getClass());
        for (Field field: fields) {
            String name = getOutputValueName(processor.getOutputPrefix(), mapper, field);
            try {
                final Object value = field.get(output);
                if (value != null) {
                    values.put(name, value);
                } else {
                    values.remove(name);
                }
            } catch (IllegalAccessException e) {
                throw ExceptionUtils.getRuntimeException(e);
            }
        }
    }
1073259
public void process(
            final TemplateModel template,
            final ITemplateContext context,
            final Writer writer) {

        Validate.isTrue(
                this.configuration == template.getConfiguration(),
                "Specified template was built by a different Template Engine instance");

        /*
         * Create the context instance that corresponds to this execution of the template engine
         */
        final IEngineContext engineContext =
                EngineContextManager.prepareEngineContext(this.configuration, template.getTemplateData(), context.getTemplateResolutionAttributes(), context);

        /*
         * Create the handler chain to process the data.
         *
         * In this case we are only processing an already existing model, which was created after some computation
         * at template-processing time. So this does not come directly from a template, and therefore pre-processors
         * should not be applied.
         *
         * As for post-processors, we know the result of this will not be directly written to output in most cases but
         * instead used to create a String that is afterwards inserted into the model as a Text node. In the only cases
         * in which this is not true is when this is used inside any kind of Lazy-processing CharSequence writer like
         * LazyProcessingCharSequence, and in such case we know those CharSequences are only used when there are
         * NO post-processors, so we are safe anyway.
         */
        final ProcessorTemplateHandler processorTemplateHandler = new ProcessorTemplateHandler();
        final ITemplateHandler processingHandlerChain =
                createTemplateProcessingHandlerChain(engineContext, false, false, processorTemplateHandler, writer);

        /*
         *  Process the template
         */
        template.process(processingHandlerChain);


        /*
         * Dispose the engine context now that processing has been done
         */
        EngineContextManager.disposeEngineContext(engineContext);

    }
709677
@Override
  protected void initializeVariableInstanceBackPointer(VariableInstanceEntity variableInstance) {
    if (processInstanceId != null) {
      variableInstance.setProcessInstanceId(processInstanceId);
    } else {
      variableInstance.setProcessInstanceId(id);
    }
    variableInstance.setExecutionId(id);
  }
300834
public function setProcessor(string $processorId, callable $processor): self
    {
        $this->_processors[$processorId] = $processor;

        return $this;
    }
707231
protected void initializeVariables(ExecutionEntity subProcessInstance, Map<String,Object> variables) {
    subProcessInstance.setVariables(variables);
  }