Class ConfigurationField
java.lang.Object
org.eclipse.lemminx.commons.config.ConfigurationField
Represents a configuration field discovered by scanning a settings class
hierarchy. Each instance pairs a reflective
Field path (parent
chain + leaf) with a configuration section name (e.g.
"xml.format.maxLineWidth" or
"xml.validation.namespaces.enabled"). Used by the scoped
workspace/configuration pull mechanism.
The scan is driven by Scope annotations: only leaf fields annotated
with @Scope(ConfigurationScope.RESOURCE) are included. Object fields
without @Scope are recursed into automatically, supporting arbitrary
nesting depth.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyConfigurationResults(Object root, List<ConfigurationField> fields, List<Object> results) Apply the results of aworkspace/configurationresponse to the given root object.static List<ConfigurationField> computeConfigurationFields(Class<?> clazz, String prefix) Recursively scan the given class hierarchy for fields annotated withScope.static org.eclipse.lsp4j.ConfigurationParamscreateConfigurationParams(String scopeUri, List<ConfigurationField> fields) Create aConfigurationParamsfor pulling scoped configuration values from the client.Returns the configuration section name (e.g.static booleanhaveSameValues(Object a, Object b, List<ConfigurationField> fields) Compare the scoped field values between two root objects.
-
Method Details
-
getSection
Returns the configuration section name (e.g."xml.format.splitAttributes"). -
computeConfigurationFields
Recursively scan the given class hierarchy for fields annotated withScope. Object fields without@Scopeare recursed into; leaf fields (primitives, String, List, enums) with@Scopeare collected.- Parameters:
clazz- the root class to scan (e.g.XMLGeneralClientSettings.class).prefix- the configuration section prefix (e.g."xml.").- Returns:
- an unmodifiable list of
ConfigurationFieldinstances.
-
createConfigurationParams
public static org.eclipse.lsp4j.ConfigurationParams createConfigurationParams(String scopeUri, List<ConfigurationField> fields) Create aConfigurationParamsfor pulling scoped configuration values from the client. EachConfigurationFieldproduces oneConfigurationItemwith the givenscopeUri.- Parameters:
scopeUri- the document URI to scope the configuration to.fields- the configuration fields to request.- Returns:
- the configuration params ready to send via
workspace/configuration.
-
applyConfigurationResults
public static void applyConfigurationResults(Object root, List<ConfigurationField> fields, List<Object> results) Apply the results of aworkspace/configurationresponse to the given root object. For each result, the method navigates the parent path on the root object, then sets the leaf field value. Null results are skipped (the field retains its current value).- Parameters:
root- the root object (e.g. aSharedSettingsinstance).fields- the configuration fields, in the same order as the configuration request items.results- the configuration response values, one per field.
-
haveSameValues
Compare the scoped field values between two root objects. Returnstrueif allScope-annotated fields have the same values in both objects.- Parameters:
a- the first root object.b- the second root object.fields- the configuration fields to compare.- Returns:
trueif all scoped values are equal.
-