Class Resources<R extends Resource<R> & Comparable<? super R>>
java.lang.Object
com.aoapps.web.resources.registry.Resources<R>
- All Implemented Interfaces:
Serializable
public class Resources<R extends Resource<R> & Comparable<? super R>>
extends Object
implements Serializable
A set of resources for a single class.
- Author:
- AO Industries, Inc.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds new resources, if not already present.boolean
Adds a new resource, if not already present.Adds new resources, if not already present.addOrdering
(boolean required, Iterable<? extends R> resources) Adds ordering constraints between multiple resources, if not already present.addOrdering
(boolean required, R... resources) Adds ordering constraints between multiple resources, if not already present.boolean
addOrdering
(boolean required, R before, R after) Adds an ordering constraint between two resources.addOrdering
(Iterable<? extends R> resources) Adds required ordering constraints between multiple resources, if not already present.addOrdering
(R... resources) Adds required ordering constraints between multiple resources, if not already present.boolean
addOrdering
(R before, R after) Adds a required ordering constraint between two resources.protected void
checkOrdering
(R before, R after) Checks that the before and after ordering is allowed.copy()
Gets a deep copy of these resources.Gets a snapshot copy of the current set of resources, in no particular order.Gets the set of all resources of the given class, first with their natural ordering, then with a topological sort to manage ordering constraints.boolean
isEmpty()
Gets these resources are empty.Removes resources.boolean
Removes a resource.Removes resources.removeOrdering
(boolean required, Iterable<? extends R> resources) Removes ordering constraints between multiple resources.removeOrdering
(boolean required, R... resources) Removes ordering constraints between multiple resources.boolean
removeOrdering
(boolean required, R before, R after) Removes an ordering constraint between two resources.removeOrdering
(Iterable<? extends R> resources) Removes required ordering constraints between multiple resources.removeOrdering
(R... resources) Removes required ordering constraints between multiple resources.boolean
removeOrdering
(R before, R after) Removes a required ordering constraint between two resources.
-
Constructor Details
-
Resources
protected Resources() -
Resources
Copy constructor. -
Resources
Union constructor.
-
-
Method Details
-
copy
Gets a deep copy of these resources. -
add
Adds a new resource, if not already present.- Returns:
true
if the resource was added, orfalse
if already exists and was not added
-
add
Adds new resources, if not already present. -
add
Adds new resources, if not already present. -
remove
Removes a resource.- Returns:
true
if the resource was removed, orfalse
if the resource was not found
-
remove
Removes resources. -
remove
Removes resources. -
checkOrdering
Checks that the before and after ordering is allowed. This is called outside of the synchronized block.- Throws:
IllegalArgumentException
- if the ordering is not allowed
-
addOrdering
Adds an ordering constraint between two resources.- Returns:
true
if the ordering was added, orfalse
if already exists and was not added
-
addOrdering
Adds a required ordering constraint between two resources. -
addOrdering
Adds ordering constraints between multiple resources, if not already present. -
addOrdering
Adds required ordering constraints between multiple resources, if not already present. -
addOrdering
Adds ordering constraints between multiple resources, if not already present. -
addOrdering
Adds required ordering constraints between multiple resources, if not already present. -
removeOrdering
Removes an ordering constraint between two resources.- Returns:
true
if the ordering was removed, orfalse
if the ordering was not found
-
removeOrdering
Removes a required ordering constraint between two resources. -
removeOrdering
Removes ordering constraints between multiple resources. -
removeOrdering
Removes required ordering constraints between multiple resources. -
removeOrdering
Removes ordering constraints between multiple resources. -
removeOrdering
Removes required ordering constraints between multiple resources. -
getSnapshot
Gets a snapshot copy of the current set of resources, in no particular order. -
getSorted
Gets the set of all resources of the given class, first with their natural ordering, then with a topological sort to manage ordering constraints. -
isEmpty
public boolean isEmpty()Gets these resources are empty.
-