Top Description Methods
org.intellij.lang.annotations

public @Interface Language

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 is a source code on a specified language. Code editors may use this annotation to enable syntax highlighting, code completion and other features inside the literals that assigned to the annotated variables, passed as arguments to the annotated parameters, or returned from the annotated methods.

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

  @Language(value = "JAVA", prefix = "class X{", suffix = "}")
  @interface JavaMethod {}

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

Method Summary

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

A constant prefix that is assumed to be implicitly added before the literal.

public @NonNls String
suffix()

A constant suffix that is assumed to be implicitly added after the literal.

public @NonNls String
value()

Language name like "JAVA", "HTML", "XML", "RegExp", etc. The complete list of supported languages is not specified.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

prefixback to summary
public @NonNls String prefix()

A constant prefix that is assumed to be implicitly added before the literal. This helps to apply proper highlighting when the program element represents only a part of the valid program. E.g. if the method parameter accepts a Java method, it could be annotated as void methodProcessor(@Language(value="JAVA", prefix="class X {", suffix="}").

Annotations
@NonNls
suffixback to summary
public @NonNls String suffix()

A constant suffix that is assumed to be implicitly added after the literal. See prefix() for details.

Annotations
@NonNls
valueback to summary
public @NonNls String value()

Language name like "JAVA", "HTML", "XML", "RegExp", etc. The complete list of supported languages is not specified. However, at least the following languages should be recognized:

  • "JAVA" - Java programming language
  • "HTML" - HTML
  • "XML" - XML
  • "RegExp" - Regular expression supported by Java java.util.regex.Pattern
Annotations
@NonNls