Class JXCSkinCache<T>
java.lang.Object
com.realtime.crossfire.jxclient.skin.skin.JXCSkinCache<T>
- Type Parameters:
T- the type of the cached elements
- All Implemented Interfaces:
Iterable<T>
Implements a cache for elements identified by name.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Forgets all cached elements.@NotNull Collection<String>getNames()Returns all defined names.voidAdds a new element to the cache.iterator()Returns all stored values.Looks up an element by name.lookupOptional(@NotNull String name) Looks up an element by name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
JXCSkinCache
Creates a new instance.- Parameters:
ident- the description of this cache used for creating error messages
-
-
Method Details
-
clear
public void clear()Forgets all cached elements. -
insert
Adds a new element to the cache.- Parameters:
name- the element name to addt- the element to add- Throws:
JXCSkinException- if the element name is not unique
-
lookup
Looks up an element by name.- Parameters:
name- the name of the element- Returns:
- the element
- Throws:
JXCSkinException- if no such element exists
-
getNames
Returns all defined names.- Returns:
- the names in alphabetical order
-
lookupOptional
Looks up an element by name.- Parameters:
name- the name of the element- Returns:
- the element or
nullif no such element exists
-
iterator
Returns all stored values.
-