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 * Configure how the paths of templates map to actual source resources.
011 *
012 * Order of path config lookup and precedence is as follows:
013 * <ol>
014 * <li>type annotated with JStache and this annotation.
015 * <li>enclosing class (of type annotated with JStache) with this annotation with inner to
016 * outer order.
017 * <li>package annotated with this annotation.
018 * <li>module annotated with this annotation.
019 * </ol>
020 * After this lookup is done then the lookup is repeated using
021 * {@link JStacheConfig#pathing()} thus using this annotation directly on an element takes
022 * precedence over {@link JStacheConfig}.
023 * <p>
024 * If multiple annotations are found the first one is picked and there is no combining of
025 * settings. See {@link JStacheConfig} for general config resultion.
026 * @author agentgt
027 * @see JStacheConfig
028 */
029@Retention(RetentionPolicy.RUNTIME)
030@Target({ ElementType.MODULE, ElementType.PACKAGE, ElementType.TYPE, ElementType.ANNOTATION_TYPE })
031@Documented
032public @interface JStachePath {
033
034        /**
035         * Will prefix the path. If you are mapping to a directory remember to end the prefix
036         * with a "/".
037         * @return prefix of path
038         */
039        public String prefix() default "";
040
041        /**
042         * Suffix the path. A common use case is to suffix with ".mustache".
043         * @return suffix of path
044         */
045        public String suffix() default "";
046
047}