com.android.dx.rop.cst
Class CstBaseMethodRef

java.lang.Object
  extended by com.android.dx.rop.cst.Constant
      extended by com.android.dx.rop.cst.TypedConstant
          extended by com.android.dx.rop.cst.CstMemberRef
              extended by com.android.dx.rop.cst.CstBaseMethodRef
All Implemented Interfaces:
TypeBearer, ToHuman, Comparable<Constant>
Direct Known Subclasses:
CstInterfaceMethodRef, CstMethodRef

public abstract class CstBaseMethodRef
extends CstMemberRef

Base class for constants of "methodish" type.

Note: As a TypeBearer, this class bears the return type of the method.


Method Summary
protected  int compareTo0(Constant other)
          Compare the values of this and another instance, which are guaranteed to be of the same class.
 int getParameterWordCount(boolean isStatic)
          Gets the number of words of parameters required by this method's descriptor.
 Prototype getPrototype()
          Gets the raw prototype of this method.
 Prototype getPrototype(boolean isStatic)
          Gets the prototype of this method as either a static or instance method.
 Type getType()
          Gets the type associated with this instance.
 boolean isClassInit()
          Gets whether this is a reference to a class initialization method.
 boolean isInstanceInit()
          Gets whether this is a reference to an instance initialization method.
 
Methods inherited from class com.android.dx.rop.cst.CstMemberRef
equals, getDefiningClass, getNat, hashCode, isCategory2, toHuman, toString
 
Methods inherited from class com.android.dx.rop.cst.TypedConstant
getBasicFrameType, getBasicType, getFrameType, isConstant
 
Methods inherited from class com.android.dx.rop.cst.Constant
compareTo, typeName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getPrototype

public final Prototype getPrototype()
Gets the raw prototype of this method. This doesn't include a this argument.

Returns:
non-null; the method prototype

getPrototype

public final Prototype getPrototype(boolean isStatic)
Gets the prototype of this method as either a static or instance method. In the case of a static method, this is the same as the raw prototype. In the case of an instance method, this has an appropriately-typed this argument as the first one.

Parameters:
isStatic - whether the method should be considered static
Returns:
non-null; the method prototype

compareTo0

protected final int compareTo0(Constant other)
Compare the values of this and another instance, which are guaranteed to be of the same class. Subclasses must implement this.

Note: This implementation just compares the defining class and name, and it is up to subclasses to compare the rest after calling super.compareTo0().

Overrides:
compareTo0 in class CstMemberRef
Parameters:
other - non-null; the instance to compare to
Returns:
-1, 0, or 1, as usual for a comparison

getType

public final Type getType()
Gets the type associated with this instance. In this case, this method returns the return type of this method.

Returns:
non-null; the method's return type

getParameterWordCount

public final int getParameterWordCount(boolean isStatic)
Gets the number of words of parameters required by this method's descriptor. Since instances of this class have no way to know if they will be used in a static or instance context, one has to indicate this explicitly as an argument. This method is just a convenient shorthand for getPrototype().getParameterTypes().getWordCount(), plus 1 if the method is to be treated as an instance method.

Parameters:
isStatic - whether the method should be considered static
Returns:
>= 0; the argument word count

isInstanceInit

public final boolean isInstanceInit()
Gets whether this is a reference to an instance initialization method. This is just a convenient shorthand for getNat().isInstanceInit().

Returns:
true iff this is a reference to an instance initialization method

isClassInit

public final boolean isClassInit()
Gets whether this is a reference to a class initialization method. This is just a convenient shorthand for getNat().isClassInit().

Returns:
true iff this is a reference to an instance initialization method


Copyright © 2015. All rights reserved.