Package org.jf.dexlib2.dexbacked
Class DexBackedMethod
- java.lang.Object
-
- org.jf.dexlib2.base.reference.BaseReference
-
- org.jf.dexlib2.base.reference.BaseMethodReference
-
- org.jf.dexlib2.dexbacked.DexBackedMethod
-
- All Implemented Interfaces:
java.lang.Comparable<MethodReference>
,Annotatable
,Member
,Method
,MethodReference
,Reference
public class DexBackedMethod extends BaseMethodReference implements Method
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jf.dexlib2.iface.reference.Reference
Reference.InvalidReferenceException
-
-
Field Summary
Fields Modifier and Type Field Description int
accessFlags
DexBackedClassDef
classDef
DexBackedDexFile
dexFile
int
methodIndex
-
Constructor Summary
Constructors Constructor Description DexBackedMethod(DexBackedDexFile dexFile, DexReader reader, DexBackedClassDef classDef, int previousMethodIndex, int hiddenApiRestrictions)
DexBackedMethod(DexBackedDexFile dexFile, DexReader reader, DexBackedClassDef classDef, int previousMethodIndex, AnnotationsDirectory.AnnotationIterator methodAnnotationIterator, AnnotationsDirectory.AnnotationIterator paramaterAnnotationIterator, int hiddenApiRestrictions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAccessFlags()
Gets the access flags for this method.java.util.Set<? extends Annotation>
getAnnotations()
Gets a set of the annotations that are applied to this method.java.lang.String
getDefiningClass()
Gets the type of the class that defines this method.java.util.Set<HiddenApiRestriction>
getHiddenApiRestrictions()
Gets the hidden api restrictions for this method.DexBackedMethodImplementation
getImplementation()
Gets a MethodImplementation object that defines the implementation of the method.int
getMethodIndex()
java.lang.String
getName()
Gets the name of this method.java.util.List<? extends java.util.Set<? extends DexBackedAnnotation>>
getParameterAnnotations()
java.util.Iterator<java.lang.String>
getParameterNames()
java.util.List<? extends MethodParameter>
getParameters()
Gets a list of the parameters of this method.java.util.List<java.lang.String>
getParameterTypes()
Gets a list of the types of the parameters of this method.java.lang.String
getReturnType()
Gets the return type of this method.int
getSize()
Calculate and return the private size of a method definition.static void
skipMethods(DexReader reader, int count)
Skips the reader over the specified number of encoded_method structures-
Methods inherited from class org.jf.dexlib2.base.reference.BaseMethodReference
compareTo, equals, hashCode, toString
-
Methods inherited from class org.jf.dexlib2.base.reference.BaseReference
validateReference
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jf.dexlib2.iface.reference.MethodReference
compareTo, equals, hashCode
-
Methods inherited from interface org.jf.dexlib2.iface.reference.Reference
validateReference
-
-
-
-
Field Detail
-
dexFile
@Nonnull public final DexBackedDexFile dexFile
-
classDef
@Nonnull public final DexBackedClassDef classDef
-
accessFlags
public final int accessFlags
-
methodIndex
public final int methodIndex
-
-
Constructor Detail
-
DexBackedMethod
public DexBackedMethod(@Nonnull DexBackedDexFile dexFile, @Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousMethodIndex, int hiddenApiRestrictions)
-
DexBackedMethod
public DexBackedMethod(@Nonnull DexBackedDexFile dexFile, @Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousMethodIndex, @Nonnull AnnotationsDirectory.AnnotationIterator methodAnnotationIterator, @Nonnull AnnotationsDirectory.AnnotationIterator paramaterAnnotationIterator, int hiddenApiRestrictions)
-
-
Method Detail
-
getMethodIndex
public int getMethodIndex()
-
getDefiningClass
@Nonnull public java.lang.String getDefiningClass()
Description copied from interface:Method
Gets the type of the class that defines this method.- Specified by:
getDefiningClass
in interfaceMember
- Specified by:
getDefiningClass
in interfaceMethod
- Specified by:
getDefiningClass
in interfaceMethodReference
- Returns:
- The type of the class that defines this method
-
getAccessFlags
public int getAccessFlags()
Description copied from interface:Method
Gets the access flags for this method. This will be a combination of the AccessFlags.* flags that are marked as compatible for use with a method.- Specified by:
getAccessFlags
in interfaceMember
- Specified by:
getAccessFlags
in interfaceMethod
- Returns:
- The access flags for this method
-
getName
@Nonnull public java.lang.String getName()
Description copied from interface:Method
Gets the name of this method.
-
getReturnType
@Nonnull public java.lang.String getReturnType()
Description copied from interface:Method
Gets the return type of this method.- Specified by:
getReturnType
in interfaceMethod
- Specified by:
getReturnType
in interfaceMethodReference
- Returns:
- The return type of this method.
-
getParameters
@Nonnull public java.util.List<? extends MethodParameter> getParameters()
Description copied from interface:Method
Gets a list of the parameters of this method. As per the MethodReference interface, the MethodParameter objects contained in the returned list also act as a simple reference to the type of the parameter. However, the MethodParameter object can also contain additional information about the parameter. Note: In some implementations, the returned list is likely to *not* provide efficient random access.- Specified by:
getParameters
in interfaceMethod
- Returns:
- A list of MethodParameter objects, representing the parameters of this method.
-
getParameterAnnotations
@Nonnull public java.util.List<? extends java.util.Set<? extends DexBackedAnnotation>> getParameterAnnotations()
-
getParameterNames
@Nonnull public java.util.Iterator<java.lang.String> getParameterNames()
-
getParameterTypes
@Nonnull public java.util.List<java.lang.String> getParameterTypes()
Description copied from interface:MethodReference
Gets a list of the types of the parameters of this method.- Specified by:
getParameterTypes
in interfaceMethodReference
- Returns:
- A list of the parameter types of this method, as strings.
-
getAnnotations
@Nonnull public java.util.Set<? extends Annotation> getAnnotations()
Description copied from interface:Method
Gets a set of the annotations that are applied to this method. The annotations in the returned set are guaranteed to have unique types.- Specified by:
getAnnotations
in interfaceAnnotatable
- Specified by:
getAnnotations
in interfaceMethod
- Returns:
- A set of the annotations that are applied to this method
-
getHiddenApiRestrictions
@Nonnull public java.util.Set<HiddenApiRestriction> getHiddenApiRestrictions()
Description copied from interface:Method
Gets the hidden api restrictions for this method. This will contain at most 1 normal flag (with isDomainSpecificApiFlag() = false), and 1 domain-specific api flag (with isDomainSpecificApiFlag() = true)- Specified by:
getHiddenApiRestrictions
in interfaceMember
- Specified by:
getHiddenApiRestrictions
in interfaceMethod
- Returns:
- A set of the hidden api restrictions for this method.
-
getImplementation
@Nullable public DexBackedMethodImplementation getImplementation()
Description copied from interface:Method
Gets a MethodImplementation object that defines the implementation of the method. If this is an abstract method in an abstract class, or an interface method in an interface definition, then the method has no implementation, and this will return null.- Specified by:
getImplementation
in interfaceMethod
- Returns:
- A MethodImplementation object defining the implementation of this method, or null if the method has no implementation
-
skipMethods
public static void skipMethods(@Nonnull DexReader reader, int count)
Skips the reader over the specified number of encoded_method structures- Parameters:
reader
- The reader to skipcount
- The number of encoded_method structures to skip over
-
getSize
public int getSize()
Calculate and return the private size of a method definition. Calculated as: method_idx_diff + access_flags + code_off + implementation size + reference size- Returns:
- size in bytes
-
-