All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.flyjingfish.android_aop_plugin.beans.ReplaceMethodInfo.kt Maven / Gradle / Ivy

Go to download

Lightweight Aop for Android platform, you deserve it, action is worse than your heartbeat

There is a newer version: 2.2.8
Show newest version
package com.flyjingfish.android_aop_plugin.beans

import org.objectweb.asm.Type

data class ReplaceMethodInfo(
    var oldOwner: String,
    var oldMethodName: String,
    var oldMethodDesc: String,
    var newOwner: String,
    var newMethodName: String,
    var newMethodDesc: String,
    var replaceType:ReplaceType = ReplaceType.METHOD,
    var newClassName :String = ""
){
    private var isCallNew:Boolean?=null
    enum class ReplaceType{
        METHOD,INIT,NEW
    }
    fun getReplaceKey():String{
        return oldOwner + oldMethodName + oldMethodDesc
    }
    fun getReplaceJsonKey():String{
        return oldOwner + newOwner
    }
    fun checkAvailable():Boolean{
        return oldOwner.isNotEmpty() && oldMethodName.isNotEmpty() && oldMethodDesc.isNotEmpty() 
                && newOwner.isNotEmpty() && newMethodName.isNotEmpty() && newMethodDesc.isNotEmpty()
    }

    fun isCallNew():Boolean{
        val oldCallNew = isCallNew
        if (oldCallNew != null){
            return oldCallNew
        }
        val callNew = if (replaceType == ReplaceType.NEW){
            val type = Type.getReturnType(newMethodDesc)
            type.descriptor != "V"
        }else{
            false
        }
        isCallNew = callNew
        return callNew
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy