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 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.

Version:
$Id: InterfaceBasedLabelParameterStrategy.java 3549 2009-04-12 12:23:23Z ltaylor $
Author:
Greg Turnquist

Constructor Summary
InterfaceBasedLabelParameterStrategy()
           
 
Method Summary
 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.
 String getNoLabel()
           
 boolean isLabeled(Method method, Object arg)
          Test if the argument implemented the LabeledData interface.
 void setNoLabel(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 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
Parameters:
method - DOCUMENT ME!
arg - DOCUMENT ME!
Returns:
DOCUMENT ME!

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
Parameters:
method - DOCUMENT ME!
arg - DOCUMENT ME!
Returns:
DOCUMENT ME!

setNoLabel

public void setNoLabel(String noLabel)


Copyright © 2004-2009 SpringSource, Inc. All Rights Reserved.