net.sf.qualitytest.blueprint.strategy.matching
Class CaseInsensitiveMethodNameMatchingStrategy

java.lang.Object
  extended by net.sf.qualitytest.blueprint.strategy.matching.CaseInsensitiveMethodNameMatchingStrategy
All Implemented Interfaces:
MatchingStrategy

public class CaseInsensitiveMethodNameMatchingStrategy
extends Object
implements MatchingStrategy

This value matching strategy matches string names case insensitively on the method name. This works for setter-based blueprinting. This MatchingStrategy does never match by type.

Author:
Dominik Seichter

Constructor Summary
CaseInsensitiveMethodNameMatchingStrategy(String name)
          Create a new CaseInsensitiveMethodNameMatchingStrategy which matches method names by default such as 'name' or 'setName' case insensitively.
CaseInsensitiveMethodNameMatchingStrategy(String name, String prefix)
          Create a new CaseInsensitiveMethodNameMatchingStrategy which matches method names by default such as 'name' or prefix + 'Name' case insensitively.
 
Method Summary
 boolean matchesByField(Field field)
          Test if a field matches this strategy.
 boolean matchesByMethod(Method method)
          Test if a method matches this strategy.
 boolean matchesByType(Class<?> clazz)
          This strategy does never match a type!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CaseInsensitiveMethodNameMatchingStrategy

public CaseInsensitiveMethodNameMatchingStrategy(String name)
Create a new CaseInsensitiveMethodNameMatchingStrategy which matches method names by default such as 'name' or 'setName' case insensitively.

Parameters:
name - The name to be matched (must not be empty or null.

CaseInsensitiveMethodNameMatchingStrategy

public CaseInsensitiveMethodNameMatchingStrategy(String name,
                                                 String prefix)
Create a new CaseInsensitiveMethodNameMatchingStrategy which matches method names by default such as 'name' or prefix + 'Name' case insensitively.

Parameters:
name - The name to be matched (must not be empty or null.
prefix - An optional prefix that is matched before the name (default is 'set'). Maybe empty but not null.
Method Detail

matchesByField

public boolean matchesByField(Field field)
Description copied from interface: MatchingStrategy
Test if a field matches this strategy.

Specified by:
matchesByField in interface MatchingStrategy
Parameters:
field - A field
Returns:
true if the strategy matches and the ValueCreationStrategy should be applied

matchesByMethod

public boolean matchesByMethod(Method method)
Description copied from interface: MatchingStrategy
Test if a method matches this strategy.

Specified by:
matchesByMethod in interface MatchingStrategy
Parameters:
method - A method
Returns:
true if the strategy matches and the ValueCreationStrategy should be applied

matchesByType

public boolean matchesByType(Class<?> clazz)
This strategy does never match a type!

Specified by:
matchesByType in interface MatchingStrategy
Parameters:
clazz - a clazz type
Returns:
false


Copyright © 2012-2013. All Rights Reserved.