All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lotaris.jee.validation.IModifier Maven / Gradle / Ivy

Go to download

This library offers components that facilitate validation of arbitrary objects and how they are serialized towards a client. It focuses on the wiring of the proposed patterns and does not contain any concrete validator implementations.

There is a newer version: 0.5.2
Show newest version
package com.lotaris.jee.validation;

import com.lotaris.jee.validation.preprocessing.modifier.Trim;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

/**
 * Modifiers are used when values need to be preprocessed, typically before validation. For example,
 * strings must be trimmed before they are validated. A modifier is the implementation of such an
 * operation.
 *
 * @author Simon Oulevay ([email protected])
 * @see Trim
 */
public interface IModifier {

	/**
	 * Returns the modifier annotation that this modifier implements.
	 *
	 * @return a modifier annotation
	 */
	Class getAnnotationType();

	/**
	 * Modifies the value of the specified field. The full object is given to support use cases
	 * where a modification may depend on the value of other fields.
	 *
	 * @param object the object
	 * @param field the field on which the modification must be applied
	 * @param annotation the annotation that was on the field
	 */
	void process(Object object, Field field, T annotation);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy