org.thymeleaf.preprocessor.IPreProcessor Maven / Gradle / Ivy
Show all versions of thymeleaf Show documentation
/*
* =============================================================================
*
* Copyright (c) 2011-2016, The THYMELEAF team (http://www.thymeleaf.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
package org.thymeleaf.preprocessor;
import org.thymeleaf.dialect.IPreProcessorDialect;
import org.thymeleaf.engine.ITemplateHandler;
import org.thymeleaf.templatemode.TemplateMode;
/**
*
* Interface defining pre-processors.
*
*
* Pre-processors are implementations of {@link ITemplateHandler} meant to be executed
* on template model events after parsing (or retrieving from cache) and before these events go
* through processing by all the applicable processors (implementations of
* {@link org.thymeleaf.processor.IProcessor}).
*
*
* Pre-processors can be used to re-shape the template model just before it is processed.
*
*
* Most of the times, the {@link PreProcessor} implementation will be used for registering pre-processors.
*
*
* @author Daniel Fernández
* @since 3.0.0
*
*/
public interface IPreProcessor {
/**
*
* Returns the template mode this pre-processor should be executed for. A pre-processor can only be linked
* to a specific template mode.
*
*
* @return the template mode.
*/
public TemplateMode getTemplateMode();
/**
*
* Returns the precedence that should be applied to this pre-processor. This will determine the order in which
* it will be executed in relation to any other pre-processors (note that the dialect precedence determined
* by {@link IPreProcessorDialect#getDialectPreProcessorPrecedence()} will be applied first).
*
*
* @return the pre-processor precedence.
*/
public int getPrecedence();
/**
*
* Returns the handler class for this pre-processor, the {@link ITemplateHandler} that implements the
* real logic to be executed.
*
*
* In order for pre-processors to work correctly, they need to implement correctly all the
* {@link ITemplateHandler} contract. In order to make this easier, extending
* {@link org.thymeleaf.engine.AbstractTemplateHandler} is recommended.
*
*
* @return the handler class.
*/
public Class extends ITemplateHandler> getHandlerClass();
}