ro.isdc.wro.model.group
Class Group

java.lang.Object
  extended by ro.isdc.wro.model.group.Group

public final class Group
extends Object

A group is an entity holding a list of resources.

Author:
Alex Objelean

Constructor Summary
Group()
          To be used by JSON serializer.
Group(String name)
          Creates a group with a name.
 
Method Summary
 Group addResource(Resource resource)
          Add a Resource to the collection of resources associated with this group.
 boolean equals(Object obj)
          
 String getName()
           
 List<Resource> getResources()
           
 int hashCode()
          
 boolean hasResourcesOfType(ResourceType resourceType)
          Check if the group has at least one resource of some type.
 void replace(Resource resource, List<Resource> expandedResources)
          Replace one resource with a list of other resources.
 void setResources(List<Resource> resources)
          This method will replace all earlier defined resources with the provided list of resources.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Group

public Group()
To be used by JSON serializer.


Group

public Group(String name)
Creates a group with a name.

Parameters:
name - of the group.
Method Detail

hasResourcesOfType

public final boolean hasResourcesOfType(ResourceType resourceType)
Check if the group has at least one resource of some type.

Parameters:
resourceType - type of the searched resource.
Returns:
true if at least one resource of some type exists.

replace

public void replace(Resource resource,
                    List<Resource> expandedResources)
Replace one resource with a list of other resources. The use case is related to wildcard expander functionality, when resources containing wildcard are replaced with a list of wildcard-free resources. The order of resources is preserved.

Parameters:
resource - to replace.
expandedResources - a list of resources to replace. If this list is empty, the result is similar to removing the resource from the group.
Throws:
IllegalArgumentException - when a missing resources is to be replaced.

getName

public String getName()
Returns:
the name

getResources

public List<Resource> getResources()
Returns:
the readonly list of resources.

addResource

public Group addResource(Resource resource)
Add a Resource to the collection of resources associated with this group.

Parameters:
resource -
Returns:

setResources

public final void setResources(List<Resource> resources)
This method will replace all earlier defined resources with the provided list of resources.

Parameters:
resources - the resources to set.

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2008-2011. All Rights Reserved.