001package io.jstach.jstache;
002
003import java.lang.annotation.Documented;
004import java.lang.annotation.ElementType;
005import java.lang.annotation.Retention;
006import java.lang.annotation.RetentionPolicy;
007import java.lang.annotation.Target;
008
009/**
010 * Configures how to name the generated template java code (the classes generated from
011 * JStache annotations). See {@link JStacheConfig} on how this configuration is fully
012 * resolved.
013 *
014 * @apiNote The default return values of {@link #UNSPECIFIED} on the annotation methods
015 * are not the actual default but rather signify not set.
016 * @author agentgt
017 * @see JStacheConfig#naming()
018 */
019@Retention(RetentionPolicy.SOURCE)
020@Target({ ElementType.ANNOTATION_TYPE })
021@Documented
022public @interface JStacheName {
023
024        /**
025         * If {@link JStache#name()} is blank the name of the generated class is derived from
026         * the models class name plus the return value if the return value is not
027         * "{@value #UNSPECIFIED}".
028         * @return suffix for generated classes.
029         * @see #DEFAULT_SUFFIX
030         */
031        String prefix() default UNSPECIFIED;
032
033        /**
034         * If {@link JStache#name()} is blank the name of the generated class is derived from
035         * the models class name plus the return value if the return value is not
036         * "{@value #UNSPECIFIED}".
037         * @return suffix for generated classes.
038         * @see #DEFAULT_SUFFIX
039         */
040        String suffix() default UNSPECIFIED;
041
042        /**
043         * The value to mean the suffix and prefix is not set.
044         * @apiNote The value is purposely not a possible valid prefix or suffix and is not
045         * the actual default.
046         */
047        public static final String UNSPECIFIED = "*";
048
049        /**
050         * The default prefix if no {@link #prefix()} is set anywhere. The generated renderers
051         * by default are prefix with this literal: <code>{@value #DEFAULT_PREFIX}</code>
052         */
053        public static final String DEFAULT_PREFIX = "";
054
055        /**
056         * The default suffix if no {@link #suffix()} is set anywhere. The generated renderers
057         * by default are suffix with this literal: <code>{@value #DEFAULT_SUFFIX}</code>
058         */
059        public static final String DEFAULT_SUFFIX = "Renderer";
060
061}