Package org.jibx.binding.classes
Class BindingMethod
- java.lang.Object
-
- org.jibx.binding.classes.BindingMethod
-
- Direct Known Subclasses:
ExistingMethod
,MethodBuilder
public abstract class BindingMethod extends java.lang.Object
Binding method information. Tracks a method used by the binding code, supplying hash code and equality checking based on the method signature and actual byte code of the method, ignoring the method name. This allows comparisons between methods generated by different bindings, and between generated and existing methods.- Version:
- 1.0
- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description private ClassFile
m_classFile
Owning class file information.
-
Constructor Summary
Constructors Modifier Constructor Description protected
BindingMethod(ClassFile cf)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static int
computeMethodHash(Method method)
Computes the hash code for a method.boolean
equals(java.lang.Object obj)
Check if objects are equal.abstract int
getAccessFlags()
Get access flags.ClassFile
getClassFile()
Get class file containing method.abstract ClassItem
getItem()
Get the method item.abstract Method
getMethod()
Get the actual method.abstract java.lang.String
getName()
Get name of method.abstract java.lang.String
getSignature()
Get signature.abstract int
hashCode()
Get hash code.void
makeAccessible(ClassFile src)
Make accessible method.abstract void
setAccessFlags(int flags)
Set access flags.
-
-
-
Field Detail
-
m_classFile
private ClassFile m_classFile
Owning class file information.
-
-
Constructor Detail
-
BindingMethod
protected BindingMethod(ClassFile cf)
Constructor.- Parameters:
cf
- owning class file information
-
-
Method Detail
-
getClassFile
public ClassFile getClassFile()
Get class file containing method.- Returns:
- class file owning this method
-
getName
public abstract java.lang.String getName()
Get name of method. This abstract method must be implemented by every subclass.- Returns:
- method name
-
getSignature
public abstract java.lang.String getSignature()
Get signature. This abstract method must be implemented by every subclass.- Returns:
- signature for method
-
getAccessFlags
public abstract int getAccessFlags()
Get access flags. This abstract method must be implemented by every subclass.- Returns:
- flags for access type of method
-
setAccessFlags
public abstract void setAccessFlags(int flags)
Set access flags. This abstract method must be implemented by every subclass.- Parameters:
flags
- access type to be set
-
getMethod
public abstract Method getMethod()
Get the actual method.- Returns:
- method information
-
getItem
public abstract ClassItem getItem()
Get the method item.- Returns:
- method item information
-
makeAccessible
public void makeAccessible(ClassFile src)
Make accessible method. Check if this method is accessible from another class, and if not decreases the access restrictions to make it accessible.- Parameters:
src
- class file for required access
-
computeMethodHash
public static int computeMethodHash(Method method)
Computes the hash code for a method. The hash code is based on the method signature, the exceptions thrown, and the actual byte code (including the exception handlers).- Returns:
- computed hash code for method
-
hashCode
public abstract int hashCode()
Get hash code. This abstract method must be implemented by every subclass, using the same algorithm in each case. See one of the existing subclasses for details.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hash code for this method
-
equals
public boolean equals(java.lang.Object obj)
Check if objects are equal. Compares first based on hash code, then on the actual byte code sequence.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
if equal objects,false
if not
-
-