org.treebind
Class JavaMethodName

java.lang.Object
  extended byorg.treebind.DefaultNameImplementation
      extended byorg.treebind.JavaMethodName
All Implemented Interfaces:
Name

public class JavaMethodName
extends DefaultNameImplementation
implements Name

Implementation of the Name interface to represent Java mathod names (composed of a local name). This class that tries to capture the role implied by a method is less straightforward than it would seem and, unless "guess" is false, methods such as "setFoo", "addFoo", "getFoo" and "getFoos" share the same name

Author:
vdv
See Also:
Name

Field Summary
static Name VALUE
          Name of the predefined "Value" method used to set the value of a property.
 
Constructor Summary
JavaMethodName(java.lang.reflect.Method method, boolean iterated)
          Creates a new JavaMethodName from the method and a flag saying if this method is "iterated" (in which case the final "s" on the method name is considered as a mark of plural and is removed).
JavaMethodName(Name name)
          Creates a new JavaMethodName from another name assumin that this is a guess unless the name is a JavaMethodName in which case its guess flag is copied.
JavaMethodName(java.lang.String localName)
          Creates a new JavaMethodName from its local name assuming that this is a "guess".
JavaMethodName(java.lang.String localName, boolean guess)
          Creates a new JavaMethodName from its local name and a flag indicating if it's a "guess" or an exect name.
 
Method Summary
 boolean equals(Name name)
          Test if two names are equal.
 boolean isGuess()
          Checks if the JavaMethodName is a guess.
 
Methods inherited from class org.treebind.DefaultNameImplementation
getDomainName, getFullName, getLocalName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.treebind.Name
getDomainName, getFullName, getLocalName
 

Field Detail

VALUE

public static final Name VALUE
Name of the predefined "Value" method used to set the value of a property.

Constructor Detail

JavaMethodName

public JavaMethodName(java.lang.reflect.Method method,
                      boolean iterated)
Creates a new JavaMethodName from the method and a flag saying if this method is "iterated" (in which case the final "s" on the method name is considered as a mark of plural and is removed). This constructor assumes that the name is a guess.

Parameters:
method - the method
iterated - an indicator that the method is "iterated"

JavaMethodName

public JavaMethodName(Name name)
Creates a new JavaMethodName from another name assumin that this is a guess unless the name is a JavaMethodName in which case its guess flag is copied.

Parameters:
name - the name

JavaMethodName

public JavaMethodName(java.lang.String localName)
Creates a new JavaMethodName from its local name assuming that this is a "guess".

Parameters:
localName - the local name.

JavaMethodName

public JavaMethodName(java.lang.String localName,
                      boolean guess)
Creates a new JavaMethodName from its local name and a flag indicating if it's a "guess" or an exect name.

Parameters:
localName - the local name
guess - flag indicating if it's a name or an exact name
Method Detail

equals

public boolean equals(Name name)
Description copied from interface: Name
Test if two names are equal.

Specified by:
equals in interface Name
Overrides:
equals in class DefaultNameImplementation

isGuess

public boolean isGuess()
Checks if the JavaMethodName is a guess.

Returns:
true if this is a guess.