Complete PodamAnnotation Target value to allow lombok full usage
May you change the PodamAnnotation from: ` package uk.co.jemos.podam.common;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to mark PODAM annotations.
*
*
* @author maxdidato
*
*/
@Documented
@Target({ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface PodamAnnotation {
}
`
to: ` package uk.co.jemos.podam.common;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to mark PODAM annotations.
*
*
* @author maxdidato
*
*/
@Documented
@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PodamAnnotation {
}
` to be use with "lombok". The addition of ElementType.METHOD allow the use on parameter "onMethod_" in lombok initialisation.
Hi,
PodamAnnotation is an annotation to annotate other annotations. It is not supposed to be applied to the methods. So @Target is correct.
Thanks, Daniil
In this case, you could change all over annotation, like PodamIntValue, etc Is-it possible ?
In my understanding you should be doing something like this with lombok
import lombok.Getter;
import lombok.Setter;
import uk.co.jemos.podam.common.PodamIntValue;
public class Example {
@Getter @Setter @PodamIntValue(minValue = 0, maxValue = 10) private int value;
}
I'm not sure why there is a need for on onMethod_ parameter.
Thanks, Daniil
Ok, I explain. I use a custom build method in a builder with hibernate validation. As you guest, I use @With. Read a sample User.tar.gz
This illustrate my purpose
You have class User with a constructor
User(final UserBuilder builder)
And class UserBuilder with a constructor
public UserBuilder(@NotNull final User user)
This cannot work. But again I don't see a reason why you try to add podam annotations to a method.
Thanks, Daniil
I use delombok and I saw my bad. I want to have this: @With(onParam_={ @PodamIntValue(minValue = 1) }) to generate this: public UserBuilder withId(@PodamIntValue(minValue = 1) Long _id) { You could close this Issue. Sorry and thanks you again