Class LanguageSettingsStorage
- java.lang.Object
-
- org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage
-
- All Implemented Interfaces:
Cloneable
public class LanguageSettingsStorage extends Object implements Cloneable
The class representing the (in-memory) storage for language settings entriesICLanguageSettingEntry
.- Since:
- 5.4
-
-
Constructor Summary
Constructors Constructor Description LanguageSettingsStorage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear all the entries for all resources and all languages.LanguageSettingsStorage
clone()
Clone storage for the entries.boolean
equals(Object obj)
Set<String>
getLanguages()
static List<ICLanguageSettingEntry>
getPooledEmptyList()
static List<ICLanguageSettingEntry>
getPooledList(List<ICLanguageSettingEntry> entries)
Find and return the equal list of entries from the pool to conserve the memory.Set<String>
getResourcePaths(String languageId)
Returns set of paths for all resources associated with entries for given language.List<ICLanguageSettingEntry>
getSettingEntries(String rcProjectPath, String languageId)
Returns the list of setting entries for the given resource and language.int
hashCode()
boolean
isEmpty()
void
setSettingEntries(String rcProjectPath, String languageId, List<? extends ICLanguageSettingEntry> entries)
Sets language settings entries for the resource and language.
-
-
-
Method Detail
-
getSettingEntries
public List<ICLanguageSettingEntry> getSettingEntries(String rcProjectPath, 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
null
if no settings defined.
-
setSettingEntries
public void setSettingEntries(String rcProjectPath, String languageId, List<? extends ICLanguageSettingEntry> entries)
Sets language settings entries for the resource and language.- Parameters:
rcProjectPath
- - path to the resource relative to the project. Ifnull
the 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:
true
if the storage is empty orfalse
otherwise.
-
clear
public void clear()
Clear all the entries for all resources and all languages.
-
getLanguages
public Set<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 Set<String> getResourcePaths(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 List<ICLanguageSettingEntry> getPooledList(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 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 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:
clone
in classObject
- Throws:
CloneNotSupportedException
-
-