package dev.mccue.magicbean; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** *
* Classes marked with this annotation must * *
* In exchange, an abstract class will be generated which * *
[...]BeanOpswhere
[...]is the name of the class.
* If the marked class * *
* Then a static method named
ofmay be generated which provides an * equivalent to an "all args constructor" * *
* If the marked class * *
* Then an implementation of equals/hashCode may be generated which is based on every non-static field. * Note that if you are using this for making a JPA Entity or similar class, you likely do not * want to do this. * *
* You may also request a default implementation of toString which includes every field. * *
* The generated class can also extend another class provided that other class is extensible * and has a zero arg constructor. *
*/ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.SOURCE) public @interface MagicBean { /** * @return Whether to generate an all args static factory method. */ boolean allArgsStaticFactory() default false; /** * @return Whether to generate an equals and hash code implementation. */ boolean equalsAndHashCode() default false; /** * @return Whether to generate a basic toString. */ boolean toString_() default false; /** * @return A class for the generated abstract class to extend. Does not support * providing type parameters to generic classes or extending classes which do not have a * zero arg constructor. */ Class> extend() default Object.class; }