Package org.smooks.engine.profile
Class DefaultProfileSet
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<String,Profile>
-
- org.smooks.engine.profile.DefaultProfileSet
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,Profile>
,ProfileSet
public class DefaultProfileSet extends LinkedHashMap<String,Profile> implements ProfileSet
Default ProfileSet implementation.- Author:
- tfennelly
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description DefaultProfileSet(String baseProfile)
Public constructor.DefaultProfileSet(String baseProfile, String[] subProfiles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProfile(String profile)
Add profile to the ProfileSet.void
addProfile(Profile profile)
Add profile to the ProfileSet.void
addProfiles(String[] subProfiles)
Add a list of subProfiles to the ProfileSet.protected void
addProfileSet(DefaultProfileSet profileSet)
Add the profiles of the supplied DefaultProfileSet to this ProfileSet.String
getBaseProfile()
Get the base profile for this profile set.Profile
getProfile(String profile)
Get a profile from theProfileSet
.boolean
isMember(String profile)
Is the specified profile a member of this profile set.Iterator<Profile>
iterator()
String
toString()
-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Methods inherited from class java.util.AbstractMap
equals, hashCode
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Method Detail
-
getBaseProfile
public String getBaseProfile()
Get the base profile for this profile set.- Specified by:
getBaseProfile
in interfaceProfileSet
- Returns:
- Base profile name.
-
isMember
public boolean isMember(String profile)
Description copied from interface:ProfileSet
Is the specified profile a member of this profile set. A profile is said to be a member of a profile set if it is the base profile of the profile set, or one of its sub profiles.- Specified by:
isMember
in interfaceProfileSet
- Parameters:
profile
- The profile to check against.- Returns:
- True if the associated device a member of the specified profile, otherwise false.
-
addProfile
public void addProfile(String profile)
Add profile to the ProfileSet.- Parameters:
profile
- The profile to add.
-
addProfile
public void addProfile(Profile profile)
Add profile to the ProfileSet.- Specified by:
addProfile
in interfaceProfileSet
- Parameters:
profile
- The profile to add.
-
getProfile
public Profile getProfile(String profile)
Get a profile from theProfileSet
.- Specified by:
getProfile
in interfaceProfileSet
- Parameters:
profile
- The name of the profile.- Returns:
- The requested Profile, or null if the profile is not a member of
the
ProfileSet
.
-
iterator
public Iterator<Profile> iterator()
- Specified by:
iterator
in interfaceProfileSet
- Returns:
- An
Iterator
that allows iteration over theProfiles
in thisProfileSet
.
-
addProfileSet
protected void addProfileSet(DefaultProfileSet profileSet)
Add the profiles of the supplied DefaultProfileSet to this ProfileSet.- Parameters:
profileSet
- The DefaultProfileSet whose profiles are to be added.
-
addProfiles
public void addProfiles(String[] subProfiles)
Add a list of subProfiles to the ProfileSet.- Parameters:
subProfiles
- The array of sub Profiles to add.
-
toString
public String toString()
- Overrides:
toString
in classAbstractMap<String,Profile>
-
-