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
argumentNames
protected Vector
exceptions
protected boolean
isAbstract
protected boolean
isConstructor
protected Vector
lines
protected String
returnType
protected StringBuffer
storedBuffer
-
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 Constructor Description MethodDefinition()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addException(String exceptionTypeName)
void
addLine(String line)
void
addToBuffer(String partOfLine)
This method can be used to store a string that will be prepended to the very next line of code enteredprotected void
adjustTypeNames(Map typeNameMap)
Iterator
argumentNames()
int
argumentNamesSize()
protected abstract boolean
argumentsEqual(MethodDefinition methodDefinition)
boolean
equals(Object object)
protected boolean
exceptionsEqual(MethodDefinition methodDefinition)
String
getArgumentName(int index)
protected Vector
getArgumentNames()
protected abstract Vector
getArgumentTypeNames()
protected abstract Vector
getArgumentTypes()
protected Vector
getExceptions()
Vector
getLines()
String
getReturnType()
int
hashCode()
boolean
isAbstract()
boolean
isConstructor()
protected void
putTypeNamesInMap(Map typeNameMap)
Used for calculating imports.protected void
replaceException(String oldExceptionName, String newExceptionName)
protected void
replaceLine(String oldLine, String newLine)
void
setIsAbstract(boolean isAbstract)
void
setIsConstructor(boolean isConstructor)
void
setReturnType(String returnType)
protected abstract void
writeArguments(CodeGenerator generator)
void
writeBody(CodeGenerator generator)
Write the code out to the generator's stream.protected void
writeThrowsClause(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
-
argumentNames
protected Vector argumentNames
-
lines
protected Vector lines
-
exceptions
protected Vector exceptions
-
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
-
adjustTypeNames
protected void adjustTypeNames(Map typeNameMap)
-
argumentsEqual
protected abstract boolean argumentsEqual(MethodDefinition methodDefinition)
-
exceptionsEqual
protected boolean exceptionsEqual(MethodDefinition methodDefinition)
-
getArgumentNames
protected Vector getArgumentNames()
-
getArgumentName
public String getArgumentName(int index)
-
argumentNames
public Iterator argumentNames()
-
argumentNamesSize
public int argumentNamesSize()
-
getArgumentTypeNames
protected abstract Vector getArgumentTypeNames()
-
getArgumentTypes
protected abstract Vector getArgumentTypes()
-
getLines
public Vector getLines()
-
getExceptions
protected Vector getExceptions()
-
getReturnType
public String getReturnType()
-
isAbstract
public boolean isAbstract()
-
isConstructor
public boolean isConstructor()
-
putTypeNamesInMap
protected void putTypeNamesInMap(Map 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:
writeBody
in classCodeDefinition
-
writeArguments
protected abstract void writeArguments(CodeGenerator generator)
-
writeThrowsClause
protected void writeThrowsClause(CodeGenerator generator)
-
-