JBoss Logging I18n Tools 1.0.0.Beta7

org.jboss.logging.generator
Class MethodDescriptor

java.lang.Object
  extended by org.jboss.logging.generator.MethodDescriptor
All Implemented Interfaces:
Comparable<MethodDescriptor>

public class MethodDescriptor
extends Object
implements Comparable<MethodDescriptor>

Author:
James R. Perkins

Method Summary
 MethodParameter cause()
          Returns the cause element if there is one, otherwise null.
 int compareTo(MethodDescriptor o)
          This comparison does not directly adhere to the general contract in that it does not honor the equals() and hashCode() contracts.
 boolean equals(Object obj)
           
 boolean hasCause()
          Returns true if there is a cause element, otherwise false .
 int hashCode()
           
 boolean hasMessageId()
          Returns true if the method has a message id, otherwise false,
 boolean isLoggerMethod()
          Returns true if this is a logger method, otherwise false.
 boolean isOverloaded()
          Returns true if the method is overloaded, otherwise false .
 String loggerMethod()
          Returns the LogMessage annotation associated with this method.
 String logLevelParameter()
          Returns the log level parameter associated with the method.
 Annotations.FormatType messageFormat()
          Returns the message format.
 int messageId()
          Returns the id of the message.
 String messageMethodName()
          Returns the name of the method used to retrieve the message.
 String messageValue()
          Returns the Message annotation associated with this method.
 String name()
          Returns the method name.
protected static MethodDescriptor of(MethodDescriptors parent, ExecutableElement method)
          Create the method descriptor.
 int parameterCount()
          Returns the number of all parameters for the method.
 Collection<MethodParameter> parameters()
          Returns an unmodifiable collection of the parameters.
 int relativeParameterCount()
          Returns the number of parameters minus the cause parameter count for the method.
 ReturnType returnType()
          Returns the return type descriptor.
 String toString()
           
 String translationKey()
          Returns the name of the key used in the translation files for the message translation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

of

protected static MethodDescriptor of(MethodDescriptors parent,
                                     ExecutableElement method)
Create the method descriptor.

Parameters:
parent - the method descriptor collection.
method - the method to describe.
Returns:
the method descriptor created for the methods.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(MethodDescriptor o)
This comparison does not directly adhere to the general contract in that it does not honor the equals() and hashCode() contracts.

The intention of this is for sorting only. Probably better suited for java.lang.Comparator, but for state safety comparing is safer internally.

Specified by:
compareTo in interface Comparable<MethodDescriptor>
See Also:
Comparable.compareTo(java.lang.Object)

hasMessageId

public boolean hasMessageId()
Returns true if the method has a message id, otherwise false,

Returns:
true if the method has a message id, otherwise false,

messageFormat

public Annotations.FormatType messageFormat()
Returns the message format.

Returns:
the message format.

messageValue

public String messageValue()
Returns the Message annotation associated with this method.

Returns:
the message annotation.

messageId

public int messageId()
Returns the id of the message.

Returns:
the id of the message.

messageMethodName

public String messageMethodName()
Returns the name of the method used to retrieve the message.

Returns:
the name of the message method.

translationKey

public String translationKey()
Returns the name of the key used in the translation files for the message translation.

Returns:
the name of the key in the translation files.

name

public String name()
Returns the method name.

Returns:
the method name.

hasCause

public boolean hasCause()
Returns true if there is a cause element, otherwise false .

Returns:
true if there is a cause element, otherwise false

isOverloaded

public boolean isOverloaded()
Returns true if the method is overloaded, otherwise false .

Returns:
true if the method is overloaded, otherwise false

cause

public MethodParameter cause()
Returns the cause element if there is one, otherwise null.

Returns:
the cause element, otherwise null.

returnType

public ReturnType returnType()
Returns the return type descriptor.

Returns:
the return type descriptor.

loggerMethod

public String loggerMethod()
Returns the LogMessage annotation associated with this method.

Returns:
the log message annotation

logLevelParameter

public String logLevelParameter()
Returns the log level parameter associated with the method.

Returns:
the log level annotation

parameters

public Collection<MethodParameter> parameters()
Returns an unmodifiable collection of the parameters.

Returns:
a collection of the parameters.

parameterCount

public int parameterCount()
Returns the number of all parameters for the method.

Returns:
the number of all parameters for the method.

relativeParameterCount

public int relativeParameterCount()
Returns the number of parameters minus the cause parameter count for the method.

Returns:
the number of parameters minus the cause parameter count for the method.

isLoggerMethod

public boolean isLoggerMethod()
Returns true if this is a logger method, otherwise false.

Returns:
true if this is a logger method, otherwise false.

JBoss Logging I18n Tools 1.0.0.Beta7

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.