Java Code Examples for org.web3j.utils.Strings#lowercaseFirstLetter()
The following examples show how to use
org.web3j.utils.Strings#lowercaseFirstLetter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WasmFunctionWrapper.java From client-sdk-java with Apache License 2.0 | 6 votes |
MethodSpec buildEventObservableFunction(String responseClassName, String functionName, List<NamedTypeName> indexedParameters, List<NamedTypeName> nonIndexedParameters) { String generatedFunctionName = Strings.lowercaseFirstLetter(functionName) + "EventObservable"; ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get(ClassName.get(rx.Observable.class), ClassName.get("", responseClassName)); MethodSpec.Builder observableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName).addModifiers(Modifier.PUBLIC) .addParameter(PlatonFilter.class, FILTER).returns(parameterizedTypeName); TypeSpec converter = TypeSpec.anonymousClassBuilder("") .addSuperinterface( ParameterizedTypeName.get(ClassName.get(Func1.class), ClassName.get(Log.class), ClassName.get("", responseClassName))) .addMethod(MethodSpec.methodBuilder("call").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC).addParameter(Log.class, "log") .returns(ClassName.get("", responseClassName)) .addStatement("$T eventValues = extractEventParametersWithLog(" + buildEventDefinitionName(functionName) + ", log)", WasmContract.WasmEventValuesWithLog.class) .addStatement("$1T typedResponse = new $1T()", ClassName.get("", responseClassName)) .addCode(buildTypedResponse("typedResponse", indexedParameters, nonIndexedParameters, true)) .addStatement("return typedResponse").build()) .build(); observableMethodBuilder.addStatement("return web3j.platonLogObservable(filter).map($L)", converter); return observableMethodBuilder.build(); }
Example 2
Source File: WasmFunctionWrapper.java From client-sdk-java with Apache License 2.0 | 6 votes |
MethodSpec buildDefaultEventObservableFunction(String responseClassName, String functionName) { String generatedFunctionName = Strings.lowercaseFirstLetter(functionName) + "EventObservable"; ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get(ClassName.get(rx.Observable.class), ClassName.get("", responseClassName)); MethodSpec.Builder observableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName).addModifiers(Modifier.PUBLIC) .addParameter(DefaultBlockParameter.class, START_BLOCK).addParameter(DefaultBlockParameter.class, END_BLOCK) .returns(parameterizedTypeName); observableMethodBuilder.addStatement("$1T filter = new $1T($2L, $3L, " + "getContractAddress())", PlatonFilter.class, START_BLOCK, END_BLOCK) .addStatement("filter.addSingleTopic($T.encode(" + buildEventDefinitionName(functionName) + "))", WasmEventEncoder.class) .addStatement("return " + generatedFunctionName + "(filter)"); return observableMethodBuilder.build(); }
Example 3
Source File: SolidityFunctionWrapper.java From client-sdk-java with Apache License 2.0 | 6 votes |
MethodSpec buildDefaultEventObservableFunction( String responseClassName, String functionName) { String generatedFunctionName = Strings.lowercaseFirstLetter(functionName) + "EventObservable"; ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get(ClassName.get(rx .Observable.class), ClassName.get("", responseClassName)); MethodSpec.Builder observableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName) .addModifiers(Modifier.PUBLIC) .addParameter(DefaultBlockParameter.class, START_BLOCK) .addParameter(DefaultBlockParameter.class, END_BLOCK) .returns(parameterizedTypeName); observableMethodBuilder.addStatement("$1T filter = new $1T($2L, $3L, " + "getContractAddress())", PlatonFilter.class, START_BLOCK, END_BLOCK) .addStatement("filter.addSingleTopic($T.encode(" + buildEventDefinitionName(functionName) + "))", EventEncoder.class) .addStatement("return " + generatedFunctionName + "(filter)"); return observableMethodBuilder .build(); }
Example 4
Source File: SolidityFunctionWrapper.java From etherscan-explorer with GNU General Public License v3.0 | 6 votes |
MethodSpec buildDefaultEventObservableFunction( String responseClassName, String functionName) { String generatedFunctionName = Strings.lowercaseFirstLetter(functionName) + "EventObservable"; ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get(ClassName.get(rx .Observable.class), ClassName.get("", responseClassName)); MethodSpec.Builder observableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName) .addModifiers(Modifier.PUBLIC) .addParameter(DefaultBlockParameter.class, START_BLOCK) .addParameter(DefaultBlockParameter.class, END_BLOCK) .returns(parameterizedTypeName); observableMethodBuilder.addStatement("$1T filter = new $1T($2L, $3L, " + "getContractAddress())", EthFilter.class, START_BLOCK, END_BLOCK) .addStatement("filter.addSingleTopic($T.encode(" + buildEventDefinitionName(functionName) + "))", EventEncoder.class) .addStatement("return " + generatedFunctionName + "(filter)"); return observableMethodBuilder .build(); }
Example 5
Source File: SolidityFunctionWrapper.java From web3j with Apache License 2.0 | 5 votes |
MethodSpec buildDefaultEventFlowableFunction(String responseClassName, String functionName) { String generatedFunctionName = Strings.lowercaseFirstLetter(functionName) + "EventFlowable"; ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get( ClassName.get(Flowable.class), ClassName.get("", responseClassName)); MethodSpec.Builder flowableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName) .addModifiers(Modifier.PUBLIC) .addParameter(DefaultBlockParameter.class, START_BLOCK) .addParameter(DefaultBlockParameter.class, END_BLOCK) .returns(parameterizedTypeName); flowableMethodBuilder .addStatement( "$1T filter = new $1T($2L, $3L, " + "getContractAddress())", EthFilter.class, START_BLOCK, END_BLOCK) .addStatement( "filter.addSingleTopic($T.encode(" + buildEventDefinitionName(functionName) + "))", EventEncoder.class) .addStatement("return " + generatedFunctionName + "(filter)"); return flowableMethodBuilder.build(); }
Example 6
Source File: SolidityFunctionWrapper.java From client-sdk-java with Apache License 2.0 | 4 votes |
MethodSpec buildEventObservableFunction( String responseClassName, String functionName, List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> indexedParameters, List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> nonIndexedParameters) throws ClassNotFoundException { String generatedFunctionName = Strings.lowercaseFirstLetter(functionName) + "EventObservable"; ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get(ClassName.get(rx .Observable.class), ClassName.get("", responseClassName)); MethodSpec.Builder observableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName) .addModifiers(Modifier.PUBLIC) .addParameter(PlatonFilter.class, FILTER) .returns(parameterizedTypeName); TypeSpec converter = TypeSpec.anonymousClassBuilder("") .addSuperinterface(ParameterizedTypeName.get( ClassName.get(Func1.class), ClassName.get(Log.class), ClassName.get("", responseClassName))) .addMethod(MethodSpec.methodBuilder("call") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .addParameter(Log.class, "log") .returns(ClassName.get("", responseClassName)) .addStatement("$T eventValues = extractEventParametersWithLog(" + buildEventDefinitionName(functionName) + ", log)", Contract.EventValuesWithLog.class) .addStatement("$1T typedResponse = new $1T()", ClassName.get("", responseClassName)) .addCode(buildTypedResponse("typedResponse", indexedParameters, nonIndexedParameters, true)) .addStatement("return typedResponse") .build()) .build(); observableMethodBuilder .addStatement("return web3j.platonLogObservable(filter).map($L)", converter); return observableMethodBuilder .build(); }
Example 7
Source File: SolidityFunctionWrapper.java From etherscan-explorer with GNU General Public License v3.0 | 4 votes |
MethodSpec buildEventObservableFunction( String responseClassName, String functionName, List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> indexedParameters, List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> nonIndexedParameters) throws ClassNotFoundException { String generatedFunctionName = Strings.lowercaseFirstLetter(functionName) + "EventObservable"; ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get(ClassName.get(rx .Observable.class), ClassName.get("", responseClassName)); MethodSpec.Builder observableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName) .addModifiers(Modifier.PUBLIC) .addParameter(EthFilter.class, FILTER) .returns(parameterizedTypeName); TypeSpec converter = TypeSpec.anonymousClassBuilder("") .addSuperinterface(ParameterizedTypeName.get( ClassName.get(Func1.class), ClassName.get(Log.class), ClassName.get("", responseClassName))) .addMethod(MethodSpec.methodBuilder("call") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .addParameter(Log.class, "log") .returns(ClassName.get("", responseClassName)) .addStatement("$T eventValues = extractEventParametersWithLog(" + buildEventDefinitionName(functionName) + ", log)", Contract.EventValuesWithLog.class) .addStatement("$1T typedResponse = new $1T()", ClassName.get("", responseClassName)) .addCode(buildTypedResponse("typedResponse", indexedParameters, nonIndexedParameters, true)) .addStatement("return typedResponse") .build()) .build(); observableMethodBuilder .addStatement("return web3j.ethLogObservable(filter).map($L)", converter); return observableMethodBuilder .build(); }
Example 8
Source File: SolidityFunctionWrapper.java From web3j with Apache License 2.0 | 4 votes |
MethodSpec buildEventFlowableFunction( String responseClassName, String functionName, List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> indexedParameters, List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> nonIndexedParameters) throws ClassNotFoundException { String generatedFunctionName = Strings.lowercaseFirstLetter(functionName) + "EventFlowable"; ParameterizedTypeName parameterizedTypeName = ParameterizedTypeName.get( ClassName.get(Flowable.class), ClassName.get("", responseClassName)); MethodSpec.Builder flowableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName) .addModifiers(Modifier.PUBLIC) .addParameter(EthFilter.class, FILTER) .returns(parameterizedTypeName); TypeSpec converter = TypeSpec.anonymousClassBuilder("") .addSuperinterface( ParameterizedTypeName.get( ClassName.get(io.reactivex.functions.Function.class), ClassName.get(Log.class), ClassName.get("", responseClassName))) .addMethod( MethodSpec.methodBuilder("apply") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .addParameter(Log.class, "log") .returns(ClassName.get("", responseClassName)) .addStatement( "$T eventValues = extractEventParametersWithLog(" + buildEventDefinitionName(functionName) + ", log)", Contract.EventValuesWithLog.class) .addStatement( "$1T typedResponse = new $1T()", ClassName.get("", responseClassName)) .addCode( buildTypedResponse( "typedResponse", indexedParameters, nonIndexedParameters, true)) .addStatement("return typedResponse") .build()) .build(); flowableMethodBuilder.addStatement( "return web3j.ethLogFlowable(filter).map($L)", converter); return flowableMethodBuilder.build(); }