Module org.eclipse.persistence.core
Class MethodDefinition
- java.lang.Object
-
- org.eclipse.persistence.internal.codegen.CodeDefinition
-
- org.eclipse.persistence.internal.codegen.MethodDefinition
-
- Direct Known Subclasses:
NonreflectiveMethodDefinition,ReflectiveMethodDefinition
public abstract class MethodDefinition extends CodeDefinition
INTERNAL:Purpose: Model a method for code generation purposes.
- Since:
- TopLink 3.0
- Author:
- James Sutherland
-
-
Field Summary
Fields Modifier and Type Field Description protected Vector<String>argumentNamesprotected Vector<String>exceptionsprotected booleanisAbstractprotected booleanisConstructorprotected Vector<String>linesprotected StringreturnTypeprotected StringBufferstoredBuffer-
Fields inherited from class org.eclipse.persistence.internal.codegen.CodeDefinition
accessLevel, comment, JAVA_LANG_PACKAGE_NAME, JAVA_UTIL_PACKAGE_NAME, name, TOPLINK_INDIRECTION_PACKAGE_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMethodDefinition()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddException(String exceptionTypeName)voidaddLine(String line)voidaddToBuffer(String partOfLine)This method can be used to store a string that will be prepended to the very next line of code enteredprotected voidadjustTypeNames(Map<String,Set<String>> typeNameMap)Iterator<String>argumentNames()intargumentNamesSize()protected abstract booleanargumentsEqual(MethodDefinition methodDefinition)booleanequals(Object object)protected booleanexceptionsEqual(MethodDefinition methodDefinition)StringgetArgumentName(int index)protected Vector<String>getArgumentNames()protected abstract Vector<String>getArgumentTypeNames()protected abstract Vector<String>getArgumentTypes()protected Vector<String>getExceptions()Vector<String>getLines()StringgetReturnType()inthashCode()booleanisAbstract()booleanisConstructor()protected voidputTypeNamesInMap(Map<String,Set<String>> typeNameMap)Used for calculating imports.protected voidreplaceException(String oldExceptionName, String newExceptionName)protected voidreplaceLine(String oldLine, String newLine)voidsetIsAbstract(boolean isAbstract)voidsetIsConstructor(boolean isConstructor)voidsetReturnType(String returnType)protected abstract voidwriteArguments(CodeGenerator generator)voidwriteBody(CodeGenerator generator)Write the code out to the generator's stream.protected voidwriteThrowsClause(CodeGenerator generator)-
Methods inherited from class org.eclipse.persistence.internal.codegen.CodeDefinition
adjustTypeName, getAccessLevel, getComment, getName, parseForTypeNames, putTypeNameInMap, setAccessLevel, setComment, setName, toString, write
-
-
-
-
Field Detail
-
isAbstract
protected boolean isAbstract
-
isConstructor
protected boolean isConstructor
-
returnType
protected String returnType
-
storedBuffer
protected StringBuffer storedBuffer
-
-
Method Detail
-
addException
public void addException(String exceptionTypeName)
-
addLine
public void addLine(String line)
-
addToBuffer
public void addToBuffer(String partOfLine)
This method can be used to store a string that will be prepended to the very next line of code entered
-
argumentsEqual
protected abstract boolean argumentsEqual(MethodDefinition methodDefinition)
-
exceptionsEqual
protected boolean exceptionsEqual(MethodDefinition methodDefinition)
-
getArgumentName
public String getArgumentName(int index)
-
argumentNamesSize
public int argumentNamesSize()
-
getReturnType
public String getReturnType()
-
isAbstract
public boolean isAbstract()
-
isConstructor
public boolean isConstructor()
-
putTypeNamesInMap
protected void putTypeNamesInMap(Map<String,Set<String>> typeNameMap)
Used for calculating imports. @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports()
-
setIsAbstract
public void setIsAbstract(boolean isAbstract)
-
setIsConstructor
public void setIsConstructor(boolean isConstructor)
-
setReturnType
public void setReturnType(String returnType)
-
writeBody
public void writeBody(CodeGenerator generator)
Write the code out to the generator's stream.- Specified by:
writeBodyin classCodeDefinition
-
writeArguments
protected abstract void writeArguments(CodeGenerator generator)
-
writeThrowsClause
protected void writeThrowsClause(CodeGenerator generator)
-
-