Class DataEntryField
- java.lang.Object
-
- org.eclipse.lemminx.services.data.DataEntryField
-
public class DataEntryField extends Object
Data entry field support used to resolve :- resolve completion : https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem
- resolve codeAction : https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeAction
{ "title": "Generate 'content.dtd' and bind with xml-model", "kind": "quickfix", ... ], "data": { "uri": "file:///.../content.xml", "participantId": "org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.NoGrammarConstraintsCodeAction#xml-model@dtd", "file": "file:///.../content.dtd" } }The two required data field for any resolve (codeAction, completion, etc) are:
- "uri" : the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix).
- "participantId" : the participant ID which must be used to process the resolve of the completion, codeAction, etc.
- extra fields (in the below sample "file" is the file URI of the grammar file which must be generated).
- Author:
- Angelo ZERR
-
-
Field Summary
Fields Modifier and Type Field Description static StringOFFSET_FIELD
-
Constructor Summary
Constructors Constructor Description DataEntryField()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.gson.JsonObjectcreateCompletionData(ICompletionRequest request, String participantId)Returns the minimal data to resolve a completion item.static com.google.gson.JsonObjectcreateData(String uri, String participantId)Create a JSON data entry field with the two required information:static StringgetParticipantId(Object data)Returns the participant ID which must be used to process the resolve of the completion, codeAction, etc and null otherwise.static StringgetProperty(Object data, String fieldName)Returns the property value of the givenfieldNameif the givendataand null otherwise.static BooleangetPropertyAsBoolean(Object data, String fieldName)Returns the value of the field as an boolean or null if the field is empty.static IntegergetPropertyAsInt(Object data, String fieldName)Returns the value of the field as an integer or null if the field is empty.static StringgetUri(Object data)Returns the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix) and null otherwise.
-
-
-
Field Detail
-
OFFSET_FIELD
public static final String OFFSET_FIELD
- See Also:
- Constant Field Values
-
-
Method Detail
-
createData
public static com.google.gson.JsonObject createData(String uri, String participantId)
Create a JSON data entry field with the two required information:- Parameters:
uri- the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix).participantId- the participant ID which must be used to process the resolve of the completion, codeAction, etc.- Returns:
- the JSON data entry field.
-
getUri
public static String getUri(Object data)
Returns the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix) and null otherwise.- Parameters:
data- the data entry field comings from the CompletionItem, CodeAction, etc.- Returns:
- the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix) and null otherwise.
-
getParticipantId
public static String getParticipantId(Object data)
Returns the participant ID which must be used to process the resolve of the completion, codeAction, etc and null otherwise.- Parameters:
data- the data entry field comings from the CompletionItem, CodeAction, etc.- Returns:
- the participant ID which must be used to process the resolve of the completion, codeAction, etc and null otherwise.
-
getProperty
public static String getProperty(Object data, String fieldName)
Returns the property value of the givenfieldNameif the givendataand null otherwise.- Parameters:
data- the data entry field comings from the CompletionItem, CodeAction, etc.fieldName- the entry field name (ex : "uri", "participantId").- Returns:
- the property value of the given
fieldNameif the givendataand null otherwise.
-
getPropertyAsInt
public static Integer getPropertyAsInt(Object data, String fieldName)
Returns the value of the field as an integer or null if the field is empty.- Parameters:
data- the object to read the field offieldName- the field to read- Returns:
- the value of the field as an integer or null if the field is empty
- Throws:
ClassCastException- if the field is not an integer
-
getPropertyAsBoolean
public static Boolean getPropertyAsBoolean(Object data, String fieldName)
Returns the value of the field as an boolean or null if the field is empty.- Parameters:
data- the object to read the field offieldName- the field to read- Returns:
- the value of the field as an boolean or null if the field is empty
- Throws:
ClassCastException- if the field is not an boolean
-
createCompletionData
public static com.google.gson.JsonObject createCompletionData(ICompletionRequest request, String participantId)
Returns the minimal data to resolve a completion item.- Parameters:
request- the completion request.participantId- the participant id to retrieve the resolver.- Returns:
- the minimal data to resolve a completion item.
-
-