net.sf.mmm.util.reflect.api
Class Signature

java.lang.Object
  extended by net.sf.mmm.util.reflect.api.Signature

public class Signature
extends Object

This class represents a "method signature". It is a container for a Class array and can be used as hash-key.

Since:
1.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  int hash
          bleeding edge performance hack
private  Class<?>[] signature
          the wrapped signature
static Signature VOID
          the void signature for a non-arg method
 
Constructor Summary
Signature(Class<?>... theSignature)
          The constructor.
Signature(Method method)
          The constructor.
Signature(Object... arguments)
          The constructor.
 
Method Summary
 boolean equals(Object other)
          
 Class<?> getType(int position)
          This method gets the type of this signature at the given position.
 int getTypeCount()
          This method gets the number of types in this signature.
 int hashCode()
          
 boolean isApplicable(Signature s)
          This method determines if the given signature is applicable for this signature.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VOID

public static final Signature VOID
the void signature for a non-arg method


signature

private final Class<?>[] signature
the wrapped signature


hash

private final int hash
bleeding edge performance hack

Constructor Detail

Signature

public Signature(Class<?>... theSignature)
The constructor.

Parameters:
theSignature - is the signature to wrap.

Signature

public Signature(Method method)
The constructor.

Parameters:
method - is the method whose signature should be wrapped.

Signature

public Signature(Object... arguments)
The constructor.

Parameters:
arguments - is a specific argument list to create a signature from.
Method Detail

isApplicable

public boolean isApplicable(Signature s)
This method determines if the given signature is applicable for this signature. Here applicable means that if this is the signature of a method, that method could be called with arguments of the given signature s.
Only call this method if this signature does NOT contain null.

Parameters:
s - is the signature to test.
Returns:
true if the given signature is applicable for this signature, false otherwise.

getTypeCount

public int getTypeCount()
This method gets the number of types in this signature.

Returns:
the type count.

getType

public Class<?> getType(int position)
This method gets the type of this signature at the given position.

Parameters:
position - is the index of the requested type. This value must be in the range from 0 to getTypeCount() - 1.
Returns:
the type at the given index.

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object other)

Overrides:
equals in class Object

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.