org.springframework.security.access.vote
Class InterfaceBasedLabelParameterStrategy

java.lang.Object
  extended by org.springframework.security.access.vote.InterfaceBasedLabelParameterStrategy
All Implemented Interfaces:
LabelParameterStrategy

public class InterfaceBasedLabelParameterStrategy
extends java.lang.Object
implements LabelParameterStrategy

This is a very useful implementation of the LabelParameterStrategy. Data objects which are meant to be labeled should implement the LabeledData interface. This strategy will then castdown to that interface for either testing or retrieval of the label.


Constructor Summary
InterfaceBasedLabelParameterStrategy()
           
 
Method Summary
 java.lang.String getLabel(java.lang.reflect.Method method, java.lang.Object arg)
          Test if the argument is labeled, and if so, downcast to LabeledData and retrieve the domain object's labeled value.
 java.lang.String getNoLabel()
           
 boolean isLabeled(java.lang.reflect.Method method, java.lang.Object arg)
          Test if the argument implemented the LabeledData interface.
 void setNoLabel(java.lang.String noLabel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterfaceBasedLabelParameterStrategy

public InterfaceBasedLabelParameterStrategy()
Method Detail

getLabel

public java.lang.String getLabel(java.lang.reflect.Method method,
                                 java.lang.Object arg)
Test if the argument is labeled, and if so, downcast to LabeledData and retrieve the domain object's labeled value. Otherwise, return an empty string. NOTE: The default for no label is an empty string. If somehow the user wants to make that a label itself, he or she must inject an alternate value to the noLabel property.

Specified by:
getLabel in interface LabelParameterStrategy
Parameters:
method - DOCUMENT ME!
arg - DOCUMENT ME!
Returns:
DOCUMENT ME!

getNoLabel

public java.lang.String getNoLabel()

isLabeled

public boolean isLabeled(java.lang.reflect.Method method,
                         java.lang.Object arg)
Test if the argument implemented the LabeledData interface. NOTE: The invoking method has no bearing for this strategy, only the argument itself.

Specified by:
isLabeled in interface LabelParameterStrategy
Parameters:
method - DOCUMENT ME!
arg - DOCUMENT ME!
Returns:
DOCUMENT ME!

setNoLabel

public void setNoLabel(java.lang.String noLabel)