Java 用于过滤实体的自定义注释

Java 用于过滤实体的自定义注释,java,annotations,factory,Java,Annotations,Factory,在(下面的代码摘录)中给出的示例中,我不太理解需要这样做的用例。有人能解释一下使用这种自定义注释的原因吗 @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Documented @EntityFiltering public @interface ProjectDetailedView { /** * Factory c

在(下面的代码摘录)中给出的示例中,我不太理解需要这样做的用例。有人能解释一下使用这种自定义注释的原因吗

@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@EntityFiltering
public @interface ProjectDetailedView {

    /**
     * Factory class for creating instances of {@code ProjectDetailedView} annotation.
     */
    public static class Factory
                        extends AnnotationLiteral<ProjectDetailedView>
                        implements ProjectDetailedView {

        private Factory() {
        }

        public static ProjectDetailedView get() {
            return new Factory();
        }
    }
}
@Target({ElementType.TYPE,ElementType.METHOD,ElementType.FIELD})
@保留(RetentionPolicy.RUNTIME)
@记录
@实体过滤
public@interface ProjectDetailedView{
/**
*用于创建{@code ProjectDetailedView}注释实例的工厂类。
*/
公共静态类工厂
扩展AnnotationLiteral
实现ProjectDetailedView{
私人工厂(){
}
公共静态ProjectDetailedView get(){
返回新工厂();
}
}
}