Package org.eclipse.lemminx.client
Class AbstractXMLNotifier
- java.lang.Object
-
- org.eclipse.lemminx.client.AbstractXMLNotifier
-
- Direct Known Subclasses:
InvalidPathWarner,LimitExceededWarner
public abstract class AbstractXMLNotifier extends Object
Sends a notification to the client via a jsonrpc notification while managing cache
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<IXMLSettingFeature,Set<String>>cache
-
Constructor Summary
Constructors Constructor Description AbstractXMLNotifier(IXMLNotificationService notificationService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToCache(IXMLSettingFeature key, String value)Addsvalueto the cache set identified bykeyIf such cache set does not exist, this method will initialize it withvalueaddedvoidevictKey(IXMLSettingFeature key)Evicts the set identified by the provided key, from the cachevoidevictValue(String value)Evicts the provided value from all cached setsbooleanexistsInCache(IXMLSettingFeature key, String value)Returns true ifvalueexists in the cache set identified bykeyand false otherwisebooleanexistsInCache(IXMLSettingFeature key, Set<String> values)Returns true ifvaluesis equal to the cache set identified bykeyand false otherwiseprotected SharedSettingsgetSharedSettings()protected voidsendNotification(String message, org.eclipse.lsp4j.MessageType messageType, org.eclipse.lsp4j.Command... commands)voidsetCacheValues(IXMLSettingFeature key, Set<String> values)Sets the cache set identified bykey
-
-
-
Field Detail
-
cache
protected final Map<IXMLSettingFeature,Set<String>> cache
-
-
Constructor Detail
-
AbstractXMLNotifier
public AbstractXMLNotifier(IXMLNotificationService notificationService)
-
-
Method Detail
-
existsInCache
public boolean existsInCache(IXMLSettingFeature key, String value)
Returns true ifvalueexists in the cache set identified bykeyand false otherwise- Parameters:
key- the key for the cache setvalue- the value to check- Returns:
- true if
valueexists in the cache set identified bykeyand false otherwise
-
existsInCache
public boolean existsInCache(IXMLSettingFeature key, Set<String> values)
Returns true ifvaluesis equal to the cache set identified bykeyand false otherwise- Parameters:
key- the key for the cache setvalues- the values set to check- Returns:
- true if
valuesis equal to the cache set identified bykeyand false otherwise
-
addToCache
public void addToCache(IXMLSettingFeature key, String value)
Addsvalueto the cache set identified bykeyIf such cache set does not exist, this method will initialize it withvalueadded- Parameters:
key- the key for the cache set to add tovalue- the value to add
-
setCacheValues
public void setCacheValues(IXMLSettingFeature key, Set<String> values)
Sets the cache set identified bykey- Parameters:
key- the key for the cache setvalues- the cache set
-
evictKey
public void evictKey(IXMLSettingFeature key)
Evicts the set identified by the provided key, from the cache- Parameters:
key-
-
evictValue
public void evictValue(String value)
Evicts the provided value from all cached sets- Parameters:
value-
-
sendNotification
protected void sendNotification(String message, org.eclipse.lsp4j.MessageType messageType, org.eclipse.lsp4j.Command... commands)
-
getSharedSettings
protected SharedSettings getSharedSettings()
-
-