001    package edu.rice.cs.cunit.threadCheck.subAnnot.predicates;
002    
003    import edu.rice.cs.cunit.threadCheck.subAnnot.PredicateLink;
004    import edu.rice.cs.cunit.threadCheck.subAnnot.Predicates;
005    import edu.rice.cs.cunit.threadCheck.subAnnot.InvariantAnnotation;
006    
007    import java.lang.annotation.ElementType;
008    import java.lang.annotation.Retention;
009    import java.lang.annotation.RetentionPolicy;
010    import java.lang.annotation.Target;
011    
012    /**
013     * An annotation used to designate methods that are only allowed to be run by a thread with the specified group name.
014     * @author Mathias Ricken
015     */
016    @Retention(RetentionPolicy.RUNTIME)
017    @Target({ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.TYPE})
018    
019    @PredicateLink(value = Predicates.class, method = "checkName")
020    public @interface ThreadWithGroupName extends InvariantAnnotation {
021        /**
022         * Group name of the thread. If the regex member is true, then this is treated as a regular expression.
023         * @return group name or regular expression for the group name of the thread allowed to run
024         */
025        String value();
026    
027        /**
028         * Determines if the string in the value member is a regular expression (true) or a plain string (false).
029         * @return true if the string in the value member is a regular expression
030         */
031        boolean regex() default false;
032    }