package link.at17.mid.tushare.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 注入前端的注解
 * <p>
 * <ol>
 * <li>
 * 注解在类上，以便在前端使用类的静态方法或常量值
 * <hr>
 * <code>
 * {@code @StaticAttribute}<br>
 * <b>public class</b> EncryptUtils {<br>
 * &nbsp;&nbsp;<b>public static</b> String <i>DEFAULT_ENC</i> = "md5";<br>
 * &nbsp;&nbsp;<b>public static</b> String md5(String plain);<br>
 * }
 * </code>
 * <hr>
 * 即可在 thymeleaf html 中使用该类的静态方法：
 * <br>
 * &nbsp;<br>
 * <code>
 * &lt;input th:value="${EncryptUtils.DEFAULT_ENC + EncryptUtils.md5(password)}"/>
 * </code><br>
 * &nbsp;<br>
 * </li>
 * <li>
 * 又如：某类内成员字段是不可修改的枚举<p>
 * <hr>
 * <code>
 * {@code @Data}<br>
 * {@code @Component}<br>
 * <b>public class</b> Network {<br>
 * &nbsp;&nbsp;&nbsp;&nbsp;{@code @StaticAttribute("ProxyTypeEnum")}<br>
 * &nbsp;&nbsp;&nbsp;&nbsp;<b>private</b> Proxy.Type <i>proxyType</i> = Proxy.Type.<i><b>DIRECT</b></i>;<br>
 * }
 * </code>
 * <hr>
 * 即可在 thymeleaf html 中使用该枚举：<br>
 * &nbsp;<br>
 * <code>
  &lt;option value="DIRECT" th:selected="${@network.proxyType == ProxyTypeEnum.DIRECT}">无&lt;/option><br>
  </code>
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.FIELD})
public @interface StaticAttribute {
    String value() default "";
}
