|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.commonclipse.Generator
public abstract class Generator
Constructor Summary | |
---|---|
Generator()
|
Method Summary | |
---|---|
protected abstract void |
addImports(org.eclipse.jdt.core.IType type)
Adds required imports to type. |
protected java.lang.String |
buildAppenderList(org.eclipse.jdt.core.IType type)
Iterates on fields and call getFieldString() on any match not in the configurable excluded list. |
protected java.util.Map |
buildFieldMap(org.eclipse.jdt.core.IType type)
Returns a Set containing all the names of fields visible by this type. |
int |
computeIndent(java.lang.String line)
Returns the indent of the given string. |
protected abstract java.lang.String |
createMethod(org.eclipse.jdt.core.IType type)
Creates the method for the ITYPE type. |
void |
generate(org.eclipse.jdt.core.IType type,
org.eclipse.swt.widgets.Shell shell)
Generates the appropriate method in type . |
void |
generateMethod(org.eclipse.jdt.core.IType type,
org.eclipse.jdt.core.ICompilationUnit cu,
org.eclipse.swt.widgets.Shell shell,
org.eclipse.core.runtime.IProgressMonitor monitor)
Generates the method by: call createMethod format the given method add it to type call addImports . |
protected abstract org.eclipse.jdt.core.IMethod |
getExistingMethod(org.eclipse.jdt.core.IType type)
Returns the existing method. |
protected abstract java.lang.String |
getFieldAppender(java.lang.String fieldName,
java.lang.String accessor)
get the "append" statement for a field. |
int |
getIndentUsed(org.eclipse.jdt.core.IJavaElement elem,
org.eclipse.jdt.core.ICompilationUnit cu)
Evaluates the indention used by a Java element. |
protected abstract java.lang.String |
getMethodName()
Returns the generated method name. |
protected boolean |
isExcluded(java.lang.String fieldName)
Checks if a given field should be excluded from generated method. |
protected boolean |
validate(org.eclipse.jdt.core.IType type,
org.eclipse.swt.widgets.Shell shell)
Checks if a corresponding method already exists and prompt the user for replacing it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Generator()
Method Detail |
---|
public void generate(org.eclipse.jdt.core.IType type, org.eclipse.swt.widgets.Shell shell)
type
.
type
- ITypeshell
- Shellprotected boolean validate(org.eclipse.jdt.core.IType type, org.eclipse.swt.widgets.Shell shell)
type
- ITypeshell
- Shell
true
if the method doesn't exists or the user has choosen to overwrite itpublic void generateMethod(org.eclipse.jdt.core.IType type, org.eclipse.jdt.core.ICompilationUnit cu, org.eclipse.swt.widgets.Shell shell, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.jdt.core.JavaModelException
type
- ITypecu
- compilation unitshell
- Shell for messagesmonitor
- progress monitor, updated during processing
org.eclipse.jdt.core.JavaModelException
- any exception in method generationpublic int getIndentUsed(org.eclipse.jdt.core.IJavaElement elem, org.eclipse.jdt.core.ICompilationUnit cu) throws org.eclipse.jdt.core.JavaModelException
elem
- Java elementcu
- compilation unit
org.eclipse.jdt.core.JavaModelException
- model exception when trying to access sourcepublic int computeIndent(java.lang.String line)
line
- the text line
protected abstract java.lang.String getMethodName()
protected abstract java.lang.String createMethod(org.eclipse.jdt.core.IType type) throws org.eclipse.jdt.core.JavaModelException
type
- Itype
org.eclipse.jdt.core.JavaModelException
- exception in creating methodprotected abstract org.eclipse.jdt.core.IMethod getExistingMethod(org.eclipse.jdt.core.IType type)
type
- IType
protected abstract void addImports(org.eclipse.jdt.core.IType type) throws org.eclipse.jdt.core.JavaModelException
type
- IType
org.eclipse.jdt.core.JavaModelException
- exception in adding importsprotected java.lang.String buildAppenderList(org.eclipse.jdt.core.IType type) throws org.eclipse.jdt.core.JavaModelException
type
- IType
org.eclipse.jdt.core.JavaModelException
- exception in analyzing fieldsprotected java.util.Map buildFieldMap(org.eclipse.jdt.core.IType type) throws org.eclipse.jdt.core.JavaModelException
type
- IType
org.eclipse.jdt.core.JavaModelException
- exception in analyzing typeprotected boolean isExcluded(java.lang.String fieldName)
fieldName
- field/property name
true
if the field should not be included in generathed methodprotected abstract java.lang.String getFieldAppender(java.lang.String fieldName, java.lang.String accessor)
fieldName
- name of the fieldaccessor
- can be different for fieldname
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |