Package org.cache2k.config
Class SectionContainer
- java.lang.Object
 - 
- java.util.AbstractCollection<ConfigSection<?,?>>
 - 
- org.cache2k.config.SectionContainer
 
 
 
- 
- All Implemented Interfaces:
 Iterable<ConfigSection<?,?>>,Collection<ConfigSection<?,?>>
public class SectionContainer extends AbstractCollection<ConfigSection<?,?>> implements Collection<ConfigSection<?,?>>
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:
 ConfigWithSections
 
- 
- 
Constructor Summary
Constructors Constructor Description SectionContainer() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(ConfigSection<?,?> section)Add a new configuration section to the container.<T extends ConfigSection<T,?>>
TgetSection(Class<T> sectionType)<T extends ConfigSection<T,?>>
TgetSection(Class<T> sectionType, T defaultFallback)Retrieve a single section from the container.Iterator<ConfigSection<?,?>>iterator()intsize()StringtoString()- 
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(ConfigSection<?,?> section)
Add a new configuration section to the container.- Specified by:
 addin interfaceCollection<ConfigSection<?,?>>- Overrides:
 addin classAbstractCollection<ConfigSection<?,?>>- Returns:
 - always 
true - Throws:
 IllegalArgumentException- if same type is already present and a singleton
 
- 
getSection
public <T extends ConfigSection<T,?>> T getSection(Class<T> sectionType, T defaultFallback)
Retrieve a single section from the container. 
- 
getSection
@Nullable public <T extends ConfigSection<T,?>> T getSection(Class<T> sectionType)
 
- 
iterator
public Iterator<ConfigSection<?,?>> iterator()
- Specified by:
 iteratorin interfaceCollection<ConfigSection<?,?>>- Specified by:
 iteratorin interfaceIterable<ConfigSection<?,?>>- Specified by:
 iteratorin classAbstractCollection<ConfigSection<?,?>>
 
- 
size
public int size()
- Specified by:
 sizein interfaceCollection<ConfigSection<?,?>>- Specified by:
 sizein classAbstractCollection<ConfigSection<?,?>>
 
- 
toString
public String toString()
- Overrides:
 toStringin classAbstractCollection<ConfigSection<?,?>>
 
 - 
 
 -