org.springframework.security.access.vote
Class InterfaceBasedLabelParameterStrategy
java.lang.Object
org.springframework.security.access.vote.InterfaceBasedLabelParameterStrategy
- All Implemented Interfaces:
- LabelParameterStrategy
public class InterfaceBasedLabelParameterStrategy
- extends 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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InterfaceBasedLabelParameterStrategy
public InterfaceBasedLabelParameterStrategy()
getLabel
public String getLabel(Method method,
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
- Returns:
- string value of the label
getNoLabel
public String getNoLabel()
isLabeled
public boolean isLabeled(Method method,
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
- Returns:
- boolean
setNoLabel
public void setNoLabel(String noLabel)