Skip to content

Instantly share code, notes, and snippets.

🤥

巴掌 JeasonWong

🤥
Block or report user

Report or block JeasonWong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View FileUtils.groovy
import com.google.common.base.Joiner
import org.gradle.api.Project
import java.security.MessageDigest
/**
* A file utils.
*/
public class FileUtils {
View gradle plugin.txt
// 获取 tansformTasks
Field transformsField = Class.forName("com.android.build.gradle.internal.pipeline.TransformManager").getDeclaredField("transforms")
transformsField.setAccessible(true)
List<Transform> transforms = transformsField.get(variant.variantData.scope.getTransformManager())
View AbstractFactory.java
public class AbstractFactory {
public static void main(String[] args) {
FactoryA factoryA = new FactoryA();
factoryA.createAndroid().tel();
factoryA.createIOS().play();
FactoryB factoryB = new FactoryB();
factoryB.createAndroid().tel();
factoryB.createIOS().play();
View Factory.java
public class Factory {
public static void main(String[] args) {
Dog dog = new FactoryDog().create();
dog.walk();
Cat cat = new FactoryCat().create();
cat.walk();
}
@JeasonWong
JeasonWong / SimpleFactory.java
Last active Sep 7, 2017
简单工厂模式
View SimpleFactory.java
public class SimpleFactory {
public static void main(String[] args) {
Platform platform = Platform.get();
System.out.println(platform);
}
public static class Platform {
View @Expose,transient.md

gson解析时可以指定某个变量是否参与序列化与反序列化

比如:

    main(){
        String str = "{\"a\":\"1\",\"b\":\"2\",\"c\":\"3\"}";
        Custom custom = gson.fromJson(str, Custom.class);
        Log.d("@=>", custom.toString());
    }
View asm-获取方法的参数名
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import org.cc.core.asm.ClassReader;
import org.cc.core.asm.ClassVisitor;
import org.cc.core.asm.ClassWriter;
import org.cc.core.asm.Label;
import org.cc.core.asm.MethodVisitor;
import org.cc.core.asm.Opcodes;
View javassist-获取方法的参数名
/**
* 获取方法参数名称
*/
@Nullable
protected static String[] getMethodParamNames(CtMethod cm) {
String[] paramNames = null;
try {
MethodInfo methodInfo = cm.getMethodInfo();
CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
View raw拷贝dex到data...data
/**
* 解压原始的dex文件
*
* @param context
* @return
* @throws IOException
*/
private String unzipRAWFile(Context context) {
String apkFilePath;
You can’t perform that action at this time.