Package org.cache2k.configuration
Class ConfigurationSectionContainer
- java.lang.Object
-
- java.util.AbstractCollection<ConfigurationSection>
-
- org.cache2k.configuration.ConfigurationSectionContainer
-
- All Implemented Interfaces:
Serializable
,Iterable<ConfigurationSection>
,Collection<ConfigurationSection>
public class ConfigurationSectionContainer extends AbstractCollection<ConfigurationSection> implements Collection<ConfigurationSection>, Serializable
Container for configuration objects. The container preserves the order of the sections and checks that one type is only added once.- Author:
- Jens Wilke
- See Also:
ConfigurationWithSections
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConfigurationSectionContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(ConfigurationSection section)
Add a new configuration section to the container.<T extends ConfigurationSection>
TgetSection(Class<T> sectionType)
Retrieve a single section from the container.Iterator<ConfigurationSection>
iterator()
int
size()
String
toString()
-
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
-
-
-
Method Detail
-
add
public boolean add(ConfigurationSection section)
Add a new configuration section to the container.- Specified by:
add
in interfaceCollection<ConfigurationSection>
- Overrides:
add
in classAbstractCollection<ConfigurationSection>
- Returns:
- always
true
- Throws:
IllegalArgumentException
- if same type is already present and a singleton
-
getSection
public <T extends ConfigurationSection> T getSection(Class<T> sectionType)
Retrieve a single section from the container.
-
iterator
public Iterator<ConfigurationSection> iterator()
- Specified by:
iterator
in interfaceCollection<ConfigurationSection>
- Specified by:
iterator
in interfaceIterable<ConfigurationSection>
- Specified by:
iterator
in classAbstractCollection<ConfigurationSection>
-
size
public int size()
- Specified by:
size
in interfaceCollection<ConfigurationSection>
- Specified by:
size
in classAbstractCollection<ConfigurationSection>
-
toString
public String toString()
- Overrides:
toString
in classAbstractCollection<ConfigurationSection>
-
-