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

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

public class BuilderMethodMatchingStrategy
extends Object
implements MatchingStrategy

Matches all methods, which belong to a class implementing the builder pattern. Matching methods are public methods of any class ending in 'Builder' (configurable) and that take exactly one argument. This matching strategy does never match by type.

Author:
Dominik Seichter

Constructor Summary
BuilderMethodMatchingStrategy()
          Create a BuilerMethodMatchingStrategy with the default suffix 'Builder' to detect classes implementing the builder pattern.
BuilderMethodMatchingStrategy(String suffix)
          Create a BuilerMethodMatchingStrategy with a configured suffix to detect classes implementing the builder pattern.
 
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)
          Test if a type matches this strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuilderMethodMatchingStrategy

public BuilderMethodMatchingStrategy()
Create a BuilerMethodMatchingStrategy with the default suffix 'Builder' to detect classes implementing the builder pattern.


BuilderMethodMatchingStrategy

public BuilderMethodMatchingStrategy(@Nonnull
                                     String suffix)
Create a BuilerMethodMatchingStrategy with a configured suffix to detect classes implementing the builder pattern.

Parameters:
suffix - Suffix of builder classes. Must not be 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)
Description copied from interface: MatchingStrategy
Test if a type matches this strategy.

Specified by:
matchesByType in interface MatchingStrategy
Parameters:
clazz - a clazz type
Returns:
true if the strategy matches and the ValueCreationStrategy should be applied


Copyright © 2012-2013. All Rights Reserved.