Interface HierarchicalRepository<T>
-
- All Known Implementing Classes:
HierarchicalObjectRepository
public interface HierarchicalRepository<T>allows objects to be mapped against a regex pattern and held in order in a list
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddMatch(String match, T value)Add a new match to the repositoryvoidaddMatch(String match, T value, boolean immutableMatch)voidclear()clear the repositoryvoidclearCache()Clears the cache.voidclearListeners()Removes all listeners.booleancontainsExactMatch(String match)booleancontainsExactWildcardMatch(String match)voiddisableListeners()voidenableListeners()intgetCacheSize()TgetDefault()TgetMatch(String match)return the value held against the nearest matchvoidregisterListener(HierarchicalRepositoryChangeListener listener)register a listener to listen for changes in the repositoryvoidremoveMatch(String match)remove a match from the repositoryvoidsetDefault(T defaultValue)set the default value to fallback to if none foundvoidswap(Set<Map.Entry<String,T>> entries)voidunRegisterListener(HierarchicalRepositoryChangeListener listener)unregister a listenerList<T>values()Return a list of Values being added
-
-
-
Method Detail
-
disableListeners
void disableListeners()
-
enableListeners
void enableListeners()
-
addMatch
void addMatch(String match, T value)
Add a new match to the repository- Parameters:
match- The regex to use to match againstvalue- the value to hold against the match
-
getMatch
T getMatch(String match)
return the value held against the nearest match- Parameters:
match- the match to look for- Returns:
- the value
-
setDefault
void setDefault(T defaultValue)
set the default value to fallback to if none found- Parameters:
defaultValue- the value
-
getDefault
T getDefault()
- Returns:
- the default match for this repo
-
removeMatch
void removeMatch(String match)
remove a match from the repository- Parameters:
match- the match to remove
-
registerListener
void registerListener(HierarchicalRepositoryChangeListener listener)
register a listener to listen for changes in the repository- Parameters:
listener-
-
unRegisterListener
void unRegisterListener(HierarchicalRepositoryChangeListener listener)
unregister a listener- Parameters:
listener-
-
clear
void clear()
clear the repository
-
clearListeners
void clearListeners()
Removes all listeners.
-
clearCache
void clearCache()
Clears the cache.
-
getCacheSize
int getCacheSize()
-
containsExactMatch
boolean containsExactMatch(String match)
-
containsExactWildcardMatch
boolean containsExactWildcardMatch(String match)
-
-