public class MethodDefinitionMap extends AbstractMethodDefinitionSource
ConfigAttributeDefinition
for each method signature defined in a bean context.For
consistency with MethodDefinitionAttributes
as well as support for
MethodDefinitionSourceAdvisor
, this implementation will return a
ConfigAttributeDefinition
containing all configuration attributes defined against:
In general you should therefore define the interface methods of your secure objects, not the
implementations. For example, define com.company.Foo.findAll=ROLE_TEST
but not
com.company.FooImpl.findAll=ROLE_TEST
.
Modifier and Type | Field and Description |
---|---|
protected Map |
methodMap
Map from Method to ApplicationDefinition
|
Constructor and Description |
---|
MethodDefinitionMap() |
Modifier and Type | Method and Description |
---|---|
void |
addSecureMethod(Class clazz,
String mappedName,
ConfigAttributeDefinition attr)
Add configuration attributes for a secure method.
|
void |
addSecureMethod(Method method,
ConfigAttributeDefinition attr)
Add configuration attributes for a secure method.
|
void |
addSecureMethod(String name,
ConfigAttributeDefinition attr)
Add configuration attributes for a secure method.
|
Iterator |
getConfigAttributeDefinitions()
Obtains the configuration attributes explicitly defined against this bean.
|
int |
getMethodMapSize()
Obtains the number of configuration attributes explicitly defined against this bean.
|
protected ConfigAttributeDefinition |
lookupAttributes(Method method)
Performs the actual lookup of the relevant
ConfigAttributeDefinition for the specified
Method which is subject of the method invocation. |
void |
setMappings(List mappings)
Easier configuration of the instance, using
MethodDefinitionSourceMapping . |
getAttributes, supports
protected Map methodMap
public void addSecureMethod(Method method, ConfigAttributeDefinition attr)
*
for matching multiple methods.method
- the method to be securedattr
- required authorities associated with the methodpublic void addSecureMethod(String name, ConfigAttributeDefinition attr)
*
for matching multiple methods.name
- class and method name, separated by a dotattr
- required authorities associated with the methodIllegalArgumentException
- DOCUMENT ME!public void addSecureMethod(Class clazz, String mappedName, ConfigAttributeDefinition attr)
*
for matching multiple methods.clazz
- target interface or classmappedName
- mapped method nameattr
- required authorities associated with the methodIllegalArgumentException
- DOCUMENT ME!public Iterator getConfigAttributeDefinitions()
lookupAttributes(Method)
as it does not have
access to a method invocation at this time.public int getMethodMapSize()
lookupAttributes(Method)
as it
does not have access to a method invocation at this time.protected ConfigAttributeDefinition lookupAttributes(Method method)
AbstractMethodDefinitionSource
ConfigAttributeDefinition
for the specified
Method
which is subject of the method invocation.Provided so subclasses need only to
provide one basic method to properly interface with the MethodDefinitionSource
.
Returns null
if there are no matching attributes for the method.
lookupAttributes
in class AbstractMethodDefinitionSource
method
- the method being invoked for which configuration attributes should be looked upConfigAttributeDefinition
that applies to the specified Method
public void setMappings(List mappings)
MethodDefinitionSourceMapping
.mappings
- List
of MethodDefinitionSourceMapping
objects.Copyright © 2004–2019 Interface21, Inc. All rights reserved.