org.milyn.profile
Class DefaultProfileSet

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap
              extended by org.milyn.profile.DefaultProfileSet
All Implemented Interfaces:
Serializable, Cloneable, Map, ProfileSet

public class DefaultProfileSet
extends LinkedHashMap
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,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
DefaultProfileSet(String baseProfile)
          Public constructor.
 
Method Summary
 void addProfile(Profile profile)
          Add profile to the ProfileSet.
 void addProfile(String 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.
static DefaultProfileSet create(String baseProfile, String[] subProfiles)
          Utility method for creating a profile set.
 String getBaseProfile()
          Get the base profile for this profile set.
 Profile getProfile(String profile)
          Get a profile from the ProfileSet.
 boolean isMember(String profile)
          Is the specified profile a member of this profile set.
 Iterator iterator()
          Get an Iterator to allow iteration over the Profilesin this ProfileSet.
 String toString()
           
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get, removeEldestEntry
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
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
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

DefaultProfileSet

public DefaultProfileSet(String baseProfile)
Public constructor.

Parameters:
baseProfile - The base profile for the profile set.
Method Detail

getBaseProfile

public String getBaseProfile()
Get the base profile for this profile set.

Specified by:
getBaseProfile in interface ProfileSet
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 interface ProfileSet
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 interface ProfileSet
Parameters:
profile - The profile to add.

getProfile

public Profile getProfile(String profile)
Get a profile from the ProfileSet.

Specified by:
getProfile in interface ProfileSet
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 iterator()
Get an Iterator to allow iteration over the Profilesin this ProfileSet.

Specified by:
iterator in interface ProfileSet
Returns:
An Iterator that allows iteration over the Profilesin this ProfileSet.

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 class AbstractMap

create

public static DefaultProfileSet create(String baseProfile,
                                       String[] subProfiles)
Utility method for creating a profile set.

Parameters:
baseProfile - The base profile.
subProfiles - The sub profiles.
Returns:
The profile set.


Copyright © 2018. All rights reserved.