Top Description Fields Constructors Methods
org.eclipse.persistence.internal.codegen

public abstract Class MethodDefinition

extends CodeDefinition
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition, org.eclipse.persistence.internal.codegen.ReflectiveMethodDefinition
Imports
java.util.*

INTERNAL:

Purpose: Model a method for code generation purposes.

Author
James Sutherland
Since
TopLink 3.0

Field Summary

Modifier and TypeField and Description
protected Vector<String>
protected Vector<String>
protected boolean
protected boolean
protected Vector<String>
protected String
protected StringBuffer
Inherited from org.eclipse.persistence.internal.codegen.CodeDefinition:
accessLevelcommentJAVA_LANG_PACKAGE_NAMEJAVA_UTIL_PACKAGE_NAMEnameTOPLINK_INDIRECTION_PACKAGE_NAME

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
addException(String exceptionTypeName)

public void
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

private void
private void
adjustLine(String line, Map<String, Set<String>> typeNameMap)

Parses the line, removing the package name for each type (and adding the appropriate import) if the type is unambiguous.

private void
adjustLines(Map<String, Set<String>> typeNameMap)

private void
protected void
public Iterator<String>
public int
protected abstract boolean
argumentsEqual(MethodDefinition methodDefinition)

public boolean
equals(Object
the reference object with which to compare.
object
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
protected boolean
public String
getArgumentName(int index)

protected Vector<String>
protected abstract Vector<String>
protected abstract Vector<String>
protected Vector<String>
public Vector<String>
public String
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
public boolean
protected void
putTypeNamesInMap(Map<String, Set<String>> typeNameMap)

Used for calculating imports.

protected void
replaceException(String oldExceptionName, String newExceptionName)

protected void
replaceLine(String oldLine, String newLine)

public void
setIsAbstract(boolean isAbstract)

public void
setIsConstructor(boolean isConstructor)

public void
setReturnType(String returnType)

protected abstract void
public void
writeBody(CodeGenerator generator)

Implements abstract org.eclipse.persistence.internal.codegen.CodeDefinition.writeBody.

Write the code out to the generator's stream.
protected void
Inherited from org.eclipse.persistence.internal.codegen.CodeDefinition:
adjustTypeNamegetAccessLevelgetCommentgetNameparseForTypeNamesputTypeNameInMapsetAccessLevelsetCommentsetNametoStringwrite

Field Detail

argumentNamesback to summary
protected Vector<String> argumentNames
exceptionsback to summary
protected Vector<String> exceptions
isAbstractback to summary
protected boolean isAbstract
isConstructorback to summary
protected boolean isConstructor
linesback to summary
protected Vector<String> lines
returnTypeback to summary
protected String returnType
storedBufferback to summary
protected StringBuffer storedBuffer

Constructor Detail

MethodDefinitionback to summary
protected MethodDefinition()

Method Detail

addExceptionback to summary
public void addException(String exceptionTypeName)
addLineback to summary
public void addLine(String line)
addToBufferback to summary
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

adjustExceptionsback to summary
private void adjustExceptions(Map<String, Set<String>> typeNameMap)
adjustLineback to summary
private void adjustLine(String line, Map<String, Set<String>> typeNameMap)

Parses the line, removing the package name for each type (and adding the appropriate import) if the type is unambiguous.

adjustLinesback to summary
private void adjustLines(Map<String, Set<String>> typeNameMap)
adjustReturnTypeback to summary
private void adjustReturnType(Map<String, Set<String>> typeNameMap)
adjustTypeNamesback to summary
protected void adjustTypeNames(Map<String, Set<String>> typeNameMap)
argumentNamesback to summary
public Iterator<String> argumentNames()
argumentNamesSizeback to summary
public int argumentNamesSize()
argumentsEqualback to summary
protected abstract boolean argumentsEqual(MethodDefinition methodDefinition)
equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
object:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
exceptionsEqualback to summary
protected boolean exceptionsEqual(MethodDefinition methodDefinition)
getArgumentNameback to summary
public String getArgumentName(int index)
getArgumentNamesback to summary
protected Vector<String> getArgumentNames()
getArgumentTypeNamesback to summary
protected abstract Vector<String> getArgumentTypeNames()
getArgumentTypesback to summary
protected abstract Vector<String> getArgumentTypes()
getExceptionsback to summary
protected Vector<String> getExceptions()
getLinesback to summary
public Vector<String> getLines()
getReturnTypeback to summary
public String getReturnType()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isAbstractback to summary
public boolean isAbstract()
isConstructorback to summary
public boolean isConstructor()
putTypeNamesInMapback to summary
protected void putTypeNamesInMap(Map<String, Set<String>> typeNameMap)

Used for calculating imports. @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports()

replaceExceptionback to summary
protected void replaceException(String oldExceptionName, String newExceptionName)
replaceLineback to summary
protected void replaceLine(String oldLine, String newLine)
setIsAbstractback to summary
public void setIsAbstract(boolean isAbstract)
setIsConstructorback to summary
public void setIsConstructor(boolean isConstructor)
setReturnTypeback to summary
public void setReturnType(String returnType)
writeArgumentsback to summary
protected abstract void writeArguments(CodeGenerator generator)
writeBodyback to summary
public void writeBody(CodeGenerator generator)

Implements abstract org.eclipse.persistence.internal.codegen.CodeDefinition.writeBody.

Write the code out to the generator's stream.

Annotations
@Override
writeThrowsClauseback to summary
protected void writeThrowsClause(CodeGenerator generator)