net.sf.commonclipse
Class ToStringGenerator

java.lang.Object
  extended by net.sf.commonclipse.Generator
      extended by net.sf.commonclipse.ToStringGenerator

public final class ToStringGenerator
extends Generator

Generator for toString() methods.

Version:
$Revision: 1.7 $ ($Author: fgiust $)
Author:
fgiust

Method Summary
protected  void addImports(org.eclipse.jdt.core.IType type)
          Adds required imports to type.
protected  java.lang.String createMethod(org.eclipse.jdt.core.IType type)
          Creates the method for the ITYPE type.
protected  org.eclipse.jdt.core.IMethod getExistingMethod(org.eclipse.jdt.core.IType type)
          Returns the existing method.
protected  java.lang.String getFieldAppender(java.lang.String fieldName, java.lang.String accessor)
          get the "append" statement for a field.
static Generator getInstance()
          Returns the ToStringGenerator instance.
protected  java.lang.String getMethodName()
          Returns the generated method name.
 
Methods inherited from class net.sf.commonclipse.Generator
buildAppenderList, buildFieldMap, computeIndent, generate, generateMethod, getIndentUsed, isExcluded, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Generator getInstance()
Returns the ToStringGenerator instance.

Returns:
instance of ToStringGenerator

getMethodName

protected java.lang.String getMethodName()
Description copied from class: Generator
Returns the generated method name.

Specified by:
getMethodName in class Generator
Returns:
String method name
See Also:
Generator.getMethodName()

addImports

protected void addImports(org.eclipse.jdt.core.IType type)
                   throws org.eclipse.jdt.core.JavaModelException
Description copied from class: Generator
Adds required imports to type.

Specified by:
addImports in class Generator
Parameters:
type - IType
Throws:
org.eclipse.jdt.core.JavaModelException - exception in adding imports
See Also:
Generator.addImports(org.eclipse.jdt.core.IType)

createMethod

protected java.lang.String createMethod(org.eclipse.jdt.core.IType type)
                                 throws org.eclipse.jdt.core.JavaModelException
Description copied from class: Generator
Creates the method for the ITYPE type.

Specified by:
createMethod in class Generator
Parameters:
type - Itype
Returns:
Method String
Throws:
org.eclipse.jdt.core.JavaModelException - exception in creating method
See Also:
Generator.createMethod(org.eclipse.jdt.core.IType)

getExistingMethod

protected org.eclipse.jdt.core.IMethod getExistingMethod(org.eclipse.jdt.core.IType type)
Description copied from class: Generator
Returns the existing method.

Specified by:
getExistingMethod in class Generator
Parameters:
type - IType
Returns:
IMethod
See Also:
Generator.getExistingMethod(org.eclipse.jdt.core.IType)

getFieldAppender

protected java.lang.String getFieldAppender(java.lang.String fieldName,
                                            java.lang.String accessor)
Description copied from class: Generator
get the "append" statement for a field.

Specified by:
getFieldAppender in class Generator
Parameters:
fieldName - name of the field
accessor - can be different for fieldname
Returns:
String
See Also:
Generator.getFieldAppender(java.lang.String, java.lang.String)


Copyright © 2003-2005 sourceforge. All Rights Reserved.