-
- 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 classDiagnostic.KindKinds of diagnostics, for example, error or warning.
-
Field Summary
Fields Modifier and Type Field and Description static longNOPOSUsed to signal that no position is available.
-
Method Summary
Methods Modifier and Type Method and Description StringgetCode()Gets a diagnostic code indicating the type of diagnostic.longgetColumnNumber()Gets the column number of the character offset returned by getPosition().longgetEndPosition()Gets the character offset from the beginning of the file associated with this diagnostic that indicates the end of the problem.Diagnostic.KindgetKind()Gets the kind of this diagnostic, for example, error or warning.longgetLineNumber()Gets the line number of the character offset returned by getPosition().StringgetMessage(Locale locale)Gets a localized message for the given locale.longgetPosition()Gets a character offset from the beginning of the source object associated with this diagnostic that indicates the location of the problem.SgetSource()Gets the source object associated with this diagnostic.longgetStartPosition()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.
nullif 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;
NOPOSifgetSource()would returnnullor 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;
NOPOSif 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;
NOPOSif and only ifgetPosition()returnsNOPOS
-
getLineNumber
long getLineNumber()
Gets the line number of the character offset returned by getPosition().- Returns:
- a line number or
NOPOSif and only ifgetPosition()returnsNOPOS
-
getColumnNumber
long getColumnNumber()
Gets the column number of the character offset returned by getPosition().- Returns:
- a column number or
NOPOSif 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
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/tools/diagnostic.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.