org.jtransfo.PreConvert Maven / Gradle / Ivy
/*
* This file is part of jTransfo, a library for converting to and from transfer objects.
* Copyright (c) PROGS bvba, Belgium
*
* The program is available in open source according to the Apache License, Version 2.0.
* For full licensing details, see LICENSE.txt in the project root.
*/
package org.jtransfo;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to specify a {@link PreConverter} to be used when converting.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Repeatable(PreConvert.List.class)
@Documented
public @interface PreConvert {
/**
* Name for the type converter, this is either name (when it implements {@link Named} or the
* Fully qualified class name.
*
* Using this allows you to avoid a compile dependency on the class name but makes the connection more brittle
* when refactoring. The value is ignored if {@link #converterClass()} is set.
*
*/
String value() default DEFAULT_NAME;
/**
* Class to use for preconvert.
*
* This requires a compile dependency on the domain class. The value has precedence over {@link #value()}.
*
*/
Class converterClass() default PreConvert.class;
/**
* Default value for {@link #value} indicating that {@link #converterClass()} should be set.
*/
String DEFAULT_NAME = "?";
/**
* Container for a list of preconverters.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Documented
public @interface List {
/**
* Actual list.
* @return list
*/
PreConvert[] value();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy