Class LanguageSettingsStorage
- java.lang.Object
-
- org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage
-
- All Implemented Interfaces:
java.lang.Cloneable
public class LanguageSettingsStorage extends java.lang.Object implements java.lang.CloneableThe class representing the (in-memory) storage for language settings entriesICLanguageSettingEntry.- Since:
- 5.4
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<ICLanguageSettingEntry>>>fStorageStorage to keep settings entries.
-
Constructor Summary
Constructors Constructor Description LanguageSettingsStorage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all the entries for all resources and all languages.LanguageSettingsStorageclone()Clone storage for the entries.booleanequals(java.lang.Object obj)java.util.Set<java.lang.String>getLanguages()static java.util.List<ICLanguageSettingEntry>getPooledEmptyList()static java.util.List<ICLanguageSettingEntry>getPooledList(java.util.List<ICLanguageSettingEntry> entries)Find and return the equal list of entries from the pool to conserve the memory.java.util.Set<java.lang.String>getResourcePaths(java.lang.String languageId)Returns set of paths for all resources associated with entries for given language.java.util.List<ICLanguageSettingEntry>getSettingEntries(java.lang.String rcProjectPath, java.lang.String languageId)Returns the list of setting entries for the given resource and language.inthashCode()booleanisEmpty()voidsetSettingEntries(java.lang.String rcProjectPath, java.lang.String languageId, java.util.List<? extends ICLanguageSettingEntry> entries)Sets language settings entries for the resource and language.
-
-
-
Field Detail
-
fStorage
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<ICLanguageSettingEntry>>> fStorage
Storage to keep settings entries.
-
-
Method Detail
-
getSettingEntries
public java.util.List<ICLanguageSettingEntry> getSettingEntries(java.lang.String rcProjectPath, java.lang.String languageId)
Returns the list of setting entries for the given resource and language.
Note that this list is unmodifiable.- Parameters:
rcProjectPath- - path to the resource relative to the project.languageId- - language id.- Returns:
- the list of setting entries or
nullif no settings defined.
-
setSettingEntries
public void setSettingEntries(java.lang.String rcProjectPath, java.lang.String languageId, java.util.List<? extends ICLanguageSettingEntry> entries)Sets language settings entries for the resource and language.- Parameters:
rcProjectPath- - path to the resource relative to the project. Ifnullthe entries are considered to be being defined as default entries for resources.languageId- - language id. Ifnull, then entries are considered to be defined for the language scope.entries- - language settings entries to set.
-
isEmpty
public boolean isEmpty()
- Returns:
trueif the storage is empty orfalseotherwise.
-
clear
public void clear()
Clear all the entries for all resources and all languages.
-
getLanguages
public java.util.Set<java.lang.String> getLanguages()
- Returns:
- set of all languages associated with the entries.
Note that the storage can keep default entries for the language scope
of the provider, so the set can contain
null.
-
getResourcePaths
public java.util.Set<java.lang.String> getResourcePaths(java.lang.String languageId)
Returns set of paths for all resources associated with entries for given language. The paths are project relative.- Parameters:
languageId- - language ID.- Returns:
- the set of resource paths associated with entries for the given language or empty set.
Note that the storage can keep default entries for resources, so the set can contain
null.
-
getPooledList
public static java.util.List<ICLanguageSettingEntry> getPooledList(java.util.List<ICLanguageSettingEntry> entries)
Find and return the equal list of entries from the pool to conserve the memory.- Parameters:
entries- - list of entries to pool.- Returns:
- returns the list of entries from the pool.
-
getPooledEmptyList
public static java.util.List<ICLanguageSettingEntry> getPooledEmptyList()
- Returns:
- Returns the empty immutable list which is pooled. Use this call rather than creating new empty array to ensure that faster shallow operator '==' can be used instead of equals() which goes deep on HashMaps.
-
clone
public LanguageSettingsStorage clone() throws java.lang.CloneNotSupportedException
Clone storage for the entries. Copies references for lists of entries as a whole. Note that that is OK as the lists kept in storage are unmodifiable and pooled.- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-