org.wicketstuff.security.swarm.actions
Class SwarmAction

java.lang.Object
  extended by org.wicketstuff.security.actions.AbstractWaspAction
      extended by org.wicketstuff.security.swarm.actions.SwarmAction
All Implemented Interfaces:
org.wicketstuff.security.actions.WaspAction
Direct Known Subclasses:
SwarmActionFactory.ImpliesOtherAction

public class SwarmAction
extends org.wicketstuff.security.actions.AbstractWaspAction

Immutable Action class based on int values to speed up inheritance checking. Each action is assigned a power of 2 int value. Bitwise or checks provide the imply logic. These actions are instantiated by an ActionFactory which provides both the name and the int value for the constructor.

Author:
marrink
See Also:
Action

Constructor Summary
protected SwarmAction(int action, String name, Object key)
          The default constructor for actions.
 
Method Summary
 int actions()
          Returns the internal representation of this action.
 org.wicketstuff.security.actions.WaspAction add(int otherActions)
          Creates a new WaspAction containing both the specified actions and the actions of this WaspAction.
 SwarmAction add(org.wicketstuff.security.actions.WaspAction other)
          Creates a new WaspAction containing both the specified actions and the actions of this WaspAction.
 boolean equals(Object obj)
          Any SwarmAction is equal to another if there 'actions' value is the same.
 org.wicketstuff.security.actions.ActionFactory getActionFactory()
           
 int hashCode()
           
 boolean implies(int otherActions)
          Check if the supplied actions are implied (bitwise or) by this SwarmAction.
 boolean implies(org.wicketstuff.security.actions.WaspAction other)
          Check if the supplied action is implied (bitwise or) by this SwarmAction.
 SwarmAction remove(int otherActions)
          Creates a new WaspAction with all the actions of this action except those specified.
 org.wicketstuff.security.actions.WaspAction remove(org.wicketstuff.security.actions.WaspAction action)
          Creates a new WaspAction with all the actions of this action except those specified.
 
Methods inherited from class org.wicketstuff.security.actions.AbstractWaspAction
getName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwarmAction

protected SwarmAction(int action,
                      String name,
                      Object key)
The default constructor for actions. Use it if your action does not inherit any other actions (other then Access), like Render.

Parameters:
action - a power of 2 which provides the base value for this action
name - the name of the action
key - the key used to register the owning ActionFactory with the Actions object
Method Detail

implies

public final boolean implies(int otherActions)
Check if the supplied actions are implied (bitwise or) by this SwarmAction.

Parameters:
otherActions - internal value of some other action(s)
Returns:
true if the actions are implied, false otherwise.

actions

public final int actions()
Returns the internal representation of this action.

Returns:
the internal value

equals

public final boolean equals(Object obj)
Any SwarmAction is equal to another if there 'actions' value is the same. In other words the name of an action is not important.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object), actions()

hashCode

public final int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

implies

public final boolean implies(org.wicketstuff.security.actions.WaspAction other)
Check if the supplied action is implied (bitwise or) by this SwarmAction.

Parameters:
other - the other action
Returns:
true if the action is implied, false otherwise.

add

public final org.wicketstuff.security.actions.WaspAction add(int otherActions)
Creates a new WaspAction containing both the specified actions and the actions of this WaspAction. This method always returns a new SwarmAction.

Parameters:
otherActions - the actions to add
Returns:
a new WaspAction containing all the actions

add

public final SwarmAction add(org.wicketstuff.security.actions.WaspAction other)
Creates a new WaspAction containing both the specified actions and the actions of this WaspAction. This method always returns a new SwarmAction.

Parameters:
other - the other action(s)
Returns:
a new WaspAction containing all the actions

remove

public final SwarmAction remove(int otherActions)
Creates a new WaspAction with all the actions of this action except those specified.

Parameters:
otherActions - the actions to remove
Returns:
a new WaspAction or this action if the specified actions were never part of this action.

remove

public final org.wicketstuff.security.actions.WaspAction remove(org.wicketstuff.security.actions.WaspAction action)
Creates a new WaspAction with all the actions of this action except those specified.

Parameters:
action - the actions to remove
Returns:
a new WaspAction or this action if the specified actions were never part of this action.

getActionFactory

public final org.wicketstuff.security.actions.ActionFactory getActionFactory()
See Also:
WaspAction.getActionFactory()


Copyright © 2006–2018 Apache Software Foundation. All rights reserved.