Turned on checkstyle

This commit is contained in:
Marcin Grzejszczak
2019-02-01 15:48:32 +01:00
parent 94e9b8f2f8
commit e4b08a083c
268 changed files with 5114 additions and 3993 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@ package com.example;
import java.util.function.Function;
import java.util.function.Supplier;
import reactor.core.publisher.Flux;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.function.compiler.FunctionCompiler;
@@ -26,11 +28,14 @@ import org.springframework.cloud.function.compiler.proxy.LambdaCompilingFunction
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.ByteArrayResource;
import reactor.core.publisher.Flux;
// @checkstyle:off
@SpringBootApplication
public class SampleApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleApplication.class, args);
}
@Bean
public Function<String, String> uppercase() {
return value -> value.toUpperCase();
@@ -52,17 +57,21 @@ public class SampleApplication {
}
@Bean
public Function<String, String> compiledUppercase(FunctionCompiler<String, String> compiler) {
public Function<String, String> compiledUppercase(
FunctionCompiler<String, String> compiler) {
String lambda = "s -> s.toUpperCase()";
LambdaCompilingFunction<String, String> function = new LambdaCompilingFunction<>(new ByteArrayResource(lambda.getBytes()), compiler);
LambdaCompilingFunction<String, String> function = new LambdaCompilingFunction<>(
new ByteArrayResource(lambda.getBytes()), compiler);
function.setTypeParameterizations("String", "String");
return function;
}
@Bean
public Function<Flux<String>, Flux<String>> compiledLowercase(FunctionCompiler<Flux<String>, Flux<String>> compiler) {
public Function<Flux<String>, Flux<String>> compiledLowercase(
FunctionCompiler<Flux<String>, Flux<String>> compiler) {
String lambda = "f->f.map(o->o.toString().toLowerCase())";
return new LambdaCompilingFunction<>(new ByteArrayResource(lambda.getBytes()), compiler);
return new LambdaCompilingFunction<>(new ByteArrayResource(lambda.getBytes()),
compiler);
}
@Bean
@@ -70,7 +79,5 @@ public class SampleApplication {
return new FunctionCompiler<>();
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleApplication.class, args);
}
}
// @checkstyle:on

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,4 +27,5 @@ public class CharCounter implements Function<String, Integer> {
public Integer apply(String word) {
return word.length();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ public class Exclaimer implements Function<Flux<String>, Flux<String>> {
@Override
public Flux<String> apply(Flux<String> words) {
return words.map(word->word+"!!!");
return words.map(word -> word + "!!!");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,4 +27,5 @@ public class Greeter implements Function<String, String> {
public String apply(String name) {
return "Hello " + name;
}
}

View File

@@ -1,5 +1,5 @@
boms.spring-cloud-dependencies: org.springframework.cloud:spring-cloud-dependencies:Edgware.SR3
dependencies.spring-cloud-function-stream: org.springframework.cloud:spring-cloud-function-stream
dependencies.spring-cloud-stream-rabbit: org.springframework.cloud:spring-cloud-starter-stream-rabbit
exclusions.spring-cloud-function-web: org.springframework.cloud:spring-cloud-starter-function-web
exclusions.http-client: com.rabbitmq:http-client
boms.spring-cloud-dependencies:org.springframework.cloud:spring-cloud-dependencies:Edgware.SR3
dependencies.spring-cloud-function-stream:org.springframework.cloud:spring-cloud-function-stream
dependencies.spring-cloud-stream-rabbit:org.springframework.cloud:spring-cloud-starter-stream-rabbit
exclusions.spring-cloud-function-web:org.springframework.cloud:spring-cloud-starter-function-web
exclusions.http-client:com.rabbitmq:http-client

View File

@@ -1,2 +1,2 @@
spring.cloud.function.stream.processor.name: uppercase
spring.cloud.function.scan.packages: com.example.functions
spring.cloud.function.stream.processor.name:uppercase
spring.cloud.function.scan.packages:com.example.functions