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

org.bcos.contract.tools.ConfigActionTools Maven / Gradle / Ivy

There is a newer version: 2.6.6
Show newest version
package org.bcos.contract.tools;

import org.bcos.contract.source.ConfigAction;
import org.bcos.web3j.abi.datatypes.Type;
import org.bcos.web3j.abi.datatypes.Utf8String;

import java.util.List;

/**
 * Created by mingzhenliu on 2018/3/13.
 */
public class ConfigActionTools {
    static void processConfigAction(ConfigAction configAction, String[]args)
    {
        try {
            switch (args[1]) {
                case "get":
                    if( args.length< 3 ){
                        System.out.println("Please input: key");
                        break;
                    }
                    System.out.println("key="+args[2]);
                    List value = configAction.get(new Utf8String(args[2])).get();
                    System.out.println(args[2]+"="+value.get(0)+","+value.get(1).getValue());
                    break;
                case "set":
                    if( args.length< 4 ){
                        System.out.println("Please input: key value");
                        break;
                    }
                    configAction.set(new Utf8String(args[2]),new Utf8String(args[3])).get();
                    break;
                default:
                    break;
            }
        } catch (Exception e)
        {
            System.out.println(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy