- All Implemented Interfaces:
Serializable
TODO: Idea: Have a default group that is always active (getDefaultGroup), and when group not provided this is assumed. This would save all the group naming and activation when the intent is to have always active.
- Author:
- AO Industries, Inc.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionactivate
(Iterables.String<?> groups) Activates the given groups.activate
(Group.Name group) Activates the given group.activate
(Group.Name... groups) Activates the given groups.activate
(Iterable<Group.Name> groups) Activates the given groups.Activates the given group.Activates the given groups.copy()
Gets a deep copy of this registry.deactivate
(Iterables.String<?> groups) Deactivates the given groups.deactivate
(Group.Name group) Deactivates the given group.deactivate
(Group.Name... groups) Deactivates the given groups.deactivate
(Iterable<Group.Name> groups) Deactivates the given groups.deactivate
(String group) Deactivates the given group.deactivate
(String... groups) Deactivates the given groups.Gets an unmodifiable view of the current activations.getGroup
(Group.Name name) Gets the group for a given name, creating it if not already present.getGroup
(Group.Name name, boolean createIfMissing) Gets the group for a given name, optionally creating it if not already present.Gets the group for a given name, creating it if not already present.Gets the group for a given name, optionally creating it if not already present.boolean
isEmpty()
Empty when there are no activations and all groups are empty.setActivation
(Group.Name group, Boolean activation) Sets the activation for the given group.
-
Constructor Details
-
Registry
public Registry() -
Registry
Copy constructor.
-
-
Method Details
-
copy
Gets a deep copy of this registry. -
getGroup
Gets the group for a given name, optionally creating it if not already present.- Parameters:
createIfMissing
- Whentrue
, will create the group if missing- Returns:
- The group or
null
when the group does not exist andcreateIfMissing
isfalse
.
-
getGroup
Gets the group for a given name, optionally creating it if not already present.- Parameters:
createIfMissing
- Whentrue
, will create the group if missing- Returns:
- The group or
null
when the group does not exist andcreateIfMissing
isfalse
. - Throws:
IllegalArgumentException
- SeeGroup.Name.checkName(java.lang.String)
.
-
getGroup
Gets the group for a given name, creating it if not already present. -
getGroup
Gets the group for a given name, creating it if not already present.- Throws:
IllegalArgumentException
- SeeGroup.Name.checkName(java.lang.String)
.
-
getActivations
Gets an unmodifiable view of the current activations.Boolean.TRUE
indicates the group is activated by this registry.Boolean.FALSE
indicates the group is deactivated by this registry.null
indicates the activation is unchanged.
Groups are inactive by default, when not activated in any of the applied registries.
This mapping is not a snapshot and may reflect concurrent changes to the registry (see
ConcurrentHashMap
). -
setActivation
Sets the activation for the given group.Boolean.TRUE
indicates the group is activated by this registry.Boolean.FALSE
indicates the group is deactivated by this registry.null
indicates the activation is unchanged.
The group does not need to be part of this registry. In fact, it will often be the case that the application-scope registry contains the resources while request/theme/view/page-scope registries activate them.
- Parameters:
activation
- Whennull
, the activation is removed.- Returns:
- The previous activation value for the group
-
activate
Activates the given group. -
activate
Activates the given group.- Throws:
IllegalArgumentException
- SeeGroup.Name.checkName(java.lang.String)
.
-
activate
Activates the given groups. -
activate
Activates the given groups. -
activate
Activates the given groups.- Throws:
IllegalArgumentException
- SeeGroup.Name.checkName(java.lang.String)
.
-
activate
Activates the given groups.- Throws:
IllegalArgumentException
- SeeGroup.Name.checkName(java.lang.String)
.
-
deactivate
Deactivates the given group. -
deactivate
Deactivates the given group.- Throws:
IllegalArgumentException
- SeeGroup.Name.checkName(java.lang.String)
.
-
deactivate
Deactivates the given groups. -
deactivate
Deactivates the given groups. -
deactivate
Deactivates the given groups.- Throws:
IllegalArgumentException
- SeeGroup.Name.checkName(java.lang.String)
.
-
deactivate
Deactivates the given groups.- Throws:
IllegalArgumentException
- SeeGroup.Name.checkName(java.lang.String)
.
-
isEmpty
public boolean isEmpty()Empty when there are no activations and all groups are empty.- See Also:
-