-
- Type Parameters:
S
- the type of source object used by this diagnostic
public interface Diagnostic<S>
Interface for diagnostics from tools. A diagnostic usually reports a problem at a specific position in a source file. However, not all diagnostics are associated with a position or a file.A position is a zero-based character offset from the beginning of a file. Negative values (except
NOPOS
) are not valid positions.Line and column numbers begin at 1. Negative values (except
NOPOS
) and 0 are not valid line or column numbers.- Since:
- 1.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static class
Diagnostic.Kind
Kinds of diagnostics, for example, error or warning.
-
Field Summary
Fields Modifier and Type Field and Description static long
NOPOS
Used to signal that no position is available.
-
Method Summary
Methods Modifier and Type Method and Description String
getCode()
Gets a diagnostic code indicating the type of diagnostic.long
getColumnNumber()
Gets the column number of the character offset returned by getPosition().long
getEndPosition()
Gets the character offset from the beginning of the file associated with this diagnostic that indicates the end of the problem.Diagnostic.Kind
getKind()
Gets the kind of this diagnostic, for example, error or warning.long
getLineNumber()
Gets the line number of the character offset returned by getPosition().String
getMessage(Locale locale)
Gets a localized message for the given locale.long
getPosition()
Gets a character offset from the beginning of the source object associated with this diagnostic that indicates the location of the problem.S
getSource()
Gets the source object associated with this diagnostic.long
getStartPosition()
Gets the character offset from the beginning of the file associated with this diagnostic that indicates the start of the problem.
-
-
-
Field Detail
-
NOPOS
static final long NOPOS
Used to signal that no position is available.- See Also:
- Constant Field Values
-
-
Method Detail
-
getKind
Diagnostic.Kind getKind()
Gets the kind of this diagnostic, for example, error or warning.- Returns:
- the kind of this diagnostic
-
getSource
S getSource()
Gets the source object associated with this diagnostic.- Returns:
- the source object associated with this diagnostic.
null
if no source object is associated with the diagnostic.
-
getPosition
long getPosition()
Gets a character offset from the beginning of the source object associated with this diagnostic that indicates the location of the problem. In addition, the following must be true:getStartPostion() <= getPosition()
getPosition() <= getEndPosition()
- Returns:
- character offset from beginning of source;
NOPOS
ifgetSource()
would returnnull
or if no location is suitable
-
getStartPosition
long getStartPosition()
Gets the character offset from the beginning of the file associated with this diagnostic that indicates the start of the problem.- Returns:
- offset from beginning of file;
NOPOS
if and only ifgetPosition()
returnsNOPOS
-
getEndPosition
long getEndPosition()
Gets the character offset from the beginning of the file associated with this diagnostic that indicates the end of the problem.- Returns:
- offset from beginning of file;
NOPOS
if and only ifgetPosition()
returnsNOPOS
-
getLineNumber
long getLineNumber()
Gets the line number of the character offset returned by getPosition().- Returns:
- a line number or
NOPOS
if and only ifgetPosition()
returnsNOPOS
-
getColumnNumber
long getColumnNumber()
Gets the column number of the character offset returned by getPosition().- Returns:
- a column number or
NOPOS
if and only ifgetPosition()
returnsNOPOS
-
getCode
String getCode()
Gets a diagnostic code indicating the type of diagnostic. The code is implementation-dependent and might benull
.- Returns:
- a diagnostic code
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
22/11/2024 10:00:29 Cette version de la page est en cache (à la date du 22/11/2024 10:00:29) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 11/06/2005, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/tools/Diagnostic.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.