com.android.dx.rop.type
Class Prototype

java.lang.Object
  extended by com.android.dx.rop.type.Prototype
All Implemented Interfaces:
Comparable<Prototype>

public final class Prototype
extends Object
implements Comparable<Prototype>

Representation of a method descriptor. Instances of this class are generally interned and may be usefully compared with each other using ==.


Method Summary
 int compareTo(Prototype other)
          
 boolean equals(Object other)
          
 String getDescriptor()
          Gets the descriptor string.
 StdTypeList getParameterFrameTypes()
          Gets the list of frame types corresponding to the list of parameter types.
 StdTypeList getParameterTypes()
          Gets the list of parameter types.
 Type getReturnType()
          Gets the return type.
 int hashCode()
          
static Prototype intern(String descriptor)
          Returns the unique instance corresponding to the given method descriptor.
static Prototype intern(String descriptor, Type definer, boolean isStatic, boolean isInit)
          Interns an instance, adding to the descriptor as necessary based on the given definer, name, and flags.
static Prototype internInts(Type returnType, int count)
          Interns an instance which consists of the given number of ints along with the given return type
 String toString()
          
 Prototype withFirstParameter(Type param)
          Returns a new interned instance, which is the same as this instance, except that it has an additional parameter prepended to the original's argument list.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

intern

public static Prototype intern(String descriptor)
Returns the unique instance corresponding to the given method descriptor. See vmspec-2 sec4.3.3 for details on the field descriptor syntax.

Parameters:
descriptor - non-null; the descriptor
Returns:
non-null; the corresponding instance
Throws:
IllegalArgumentException - thrown if the descriptor has invalid syntax

intern

public static Prototype intern(String descriptor,
                               Type definer,
                               boolean isStatic,
                               boolean isInit)
Interns an instance, adding to the descriptor as necessary based on the given definer, name, and flags. For example, an init method has an uninitialized object of type definer as its first argument.

Parameters:
descriptor - non-null; the descriptor string
definer - non-null; class the method is defined on
isStatic - whether this is a static method
isInit - whether this is an init method
Returns:
non-null; the interned instance

internInts

public static Prototype internInts(Type returnType,
                                   int count)
Interns an instance which consists of the given number of ints along with the given return type

Parameters:
returnType - non-null; the return type
count - > 0; the number of elements in the prototype
Returns:
non-null; the interned instance

equals

public boolean equals(Object other)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

compareTo

public int compareTo(Prototype other)

Specified by:
compareTo in interface Comparable<Prototype>

toString

public String toString()

Overrides:
toString in class Object

getDescriptor

public String getDescriptor()
Gets the descriptor string.

Returns:
non-null; the descriptor

getReturnType

public Type getReturnType()
Gets the return type.

Returns:
non-null; the return type

getParameterTypes

public StdTypeList getParameterTypes()
Gets the list of parameter types.

Returns:
non-null; the list of parameter types

getParameterFrameTypes

public StdTypeList getParameterFrameTypes()
Gets the list of frame types corresponding to the list of parameter types. The difference between the two lists (if any) is that all "intlike" types (see Type.isIntlike()) are replaced by Type.INT.

Returns:
non-null; the list of parameter frame types

withFirstParameter

public Prototype withFirstParameter(Type param)
Returns a new interned instance, which is the same as this instance, except that it has an additional parameter prepended to the original's argument list.

Parameters:
param - non-null; the new first parameter
Returns:
non-null; an appropriately-constructed instance


Copyright © 2013. All Rights Reserved.