Top Description Methods
org.intellij.lang.annotations

public @Interface Pattern

extends Annotation
Annotations
@Documented
@Retention:CLASS
@Target:METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, ANNOTATION_TYPE
Imports
org.jetbrains.annotations.NonNls, java.lang.annotation.Documented, .Retention, .RetentionPolicy, .Target

Specifies that an element of the program represents a string that must completely match given regular expression. Code editors may use this annotation to report errors if the literals that assigned to the annotated variables, passed as arguments to the annotated parameters, or returned from the annotated methods, do not match the supplied pattern.

This annotation also could be used as a meta-annotation, to define other annotations for convenience. E.g. the following annotation could be defined to annotate the strings that represent UUIDs:

@Pattern("[\\dA-Fa-f]{8}-[\\dA-Fa-f]{4}-[\\dA-Fa-f]{4}-[\\dA-Fa-f]{4}-[\\dA-Fa-f]{12}")
@interface UUID {}

Note that using the derived annotation as meta-annotation is not supported. Meta-annotation works only one level deep.

See Also
RegExp

Method Summary

Modifier and TypeMethod and Description
public @NonNls String
value()

A regular expression that matches all the valid string literals that assigned to the annotated variables, passed as arguments to the annotated parameters, or returned from the annotated methods.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public @NonNls String value()

A regular expression that matches all the valid string literals that assigned to the annotated variables, passed as arguments to the annotated parameters, or returned from the annotated methods.

Annotations
@Language:RegExp
@NonNls