org.hamcrest.generator
Class FactoryMethod

java.lang.Object
  extended by org.hamcrest.generator.FactoryMethod

public class FactoryMethod
extends java.lang.Object

Represents a Matcher Factory method.

This class uses Strings to represent things instead of java.lang.reflect equivalents, allowing methods to be defined from sources other than reflection of classes in the classpath.

Author:
Joe Walnes
See Also:
SugarGenerator

Nested Class Summary
static class FactoryMethod.Parameter
          Represents a parameter passed to a factory method.
 
Constructor Summary
FactoryMethod(java.lang.String matcherClass, java.lang.String factoryMethod, java.lang.String returnType)
           
 
Method Summary
 void addException(java.lang.String exception)
           
 void addGenericTypeParameter(java.lang.String genericTypeParameter)
           
 void addParameter(java.lang.String type, java.lang.String name)
           
 boolean equals(java.lang.Object obj)
           
 java.util.List<java.lang.String> getExceptions()
          List of exceptions thrown by factory method.
 java.util.List<java.lang.String> getGenericTypeParameters()
          List of generic type parameters for factory method definition.
 java.lang.String getGenerifiedType()
          Generified type of matcher.
 java.lang.String getJavaDoc()
          JavaDoc definition of factory method.
 java.lang.String getMatcherClass()
          Original class this factory method came from.
 java.lang.String getName()
          Original name of factory method.
 java.util.List<FactoryMethod.Parameter> getParameters()
          List of Parameters passed to factory method.
 java.lang.String getReturnType()
           
 int hashCode()
           
 void setGenerifiedType(java.lang.String generifiedType)
           
 void setJavaDoc(java.lang.String javaDoc)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FactoryMethod

public FactoryMethod(java.lang.String matcherClass,
                     java.lang.String factoryMethod,
                     java.lang.String returnType)
Method Detail

getMatcherClass

public java.lang.String getMatcherClass()
Original class this factory method came from.


getReturnType

public java.lang.String getReturnType()
Returns:
The fully qualified name of the type returned by the method. This should be a subclass of org.hamcrest.Matcher.

getName

public java.lang.String getName()
Original name of factory method.


setGenerifiedType

public void setGenerifiedType(java.lang.String generifiedType)

getGenerifiedType

public java.lang.String getGenerifiedType()
Generified type of matcher. ie. 'public Matcher<THISBIT> blah(...)'


addParameter

public void addParameter(java.lang.String type,
                         java.lang.String name)

getParameters

public java.util.List<FactoryMethod.Parameter> getParameters()
List of Parameters passed to factory method. ie. 'public Matcher<...&ht;> blah(THIS, AND, THAT)'


addException

public void addException(java.lang.String exception)

getExceptions

public java.util.List<java.lang.String> getExceptions()
List of exceptions thrown by factory method. ie. 'public Matcher<...> blah(...) throws THIS, THAT'


addGenericTypeParameter

public void addGenericTypeParameter(java.lang.String genericTypeParameter)

getGenericTypeParameters

public java.util.List<java.lang.String> getGenericTypeParameters()
List of generic type parameters for factory method definition. ie. 'public <THIS,THAT> Matcher<...> blah(...)'


setJavaDoc

public void setJavaDoc(java.lang.String javaDoc)

getJavaDoc

public java.lang.String getJavaDoc()
JavaDoc definition of factory method. Excludes surrounding comment markers. Note that using standard Java reflection it is not possible to obtain this, however source code parsers can read this.


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object