diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ExpressionSerializer.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ExpressionSerializer.java deleted file mode 100644 index 2b2a16c8e..000000000 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ExpressionSerializer.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2016 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.stream.binder; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -import org.springframework.expression.Expression; - -/** - * JSON serializer for Expression value. - * - * @author Ilayaperumal Gopinathan - */ -public class ExpressionSerializer extends JsonSerializer { - - public ExpressionSerializer() { - } - - @Override - public void serialize(Expression expression, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) - throws IOException { - if (expression != null) { - jsonGenerator.writeString(expression.getExpressionString()); - } - } -} diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/JavaClassMimeTypeUtils.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/JavaClassMimeTypeUtils.java index cad16565b..b80adec4a 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/JavaClassMimeTypeUtils.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/JavaClassMimeTypeUtils.java @@ -69,26 +69,4 @@ public abstract class JavaClassMimeTypeUtils { } return mimeType; } - - /** - * Retrieve the class name from the type parameter in {@link MimeType}. - * - * @param mimeType {@link MimeType} to retrieve class name from - * @return class name from the type parameter in MimeType and null if the class name cannot be determined - */ - public static String classNameFromMimeType(MimeType mimeType) { - Assert.notNull(mimeType, "mimeType cannot be null."); - String className = mimeType.getParameter("type"); - if (className == null) { - return null; - } - // unwrap quotes if any - className = className.replace("\"", ""); - - // restore trailing ';' - if (className.contains("[L")) { - className += ";"; - } - return className; - } } diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ProducerProperties.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ProducerProperties.java index 68cbe3f71..bdaf2fd9f 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ProducerProperties.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ProducerProperties.java @@ -16,11 +16,16 @@ package org.springframework.cloud.stream.binder; +import java.io.IOException; + import javax.validation.constraints.AssertTrue; import javax.validation.constraints.Min; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.springframework.cloud.stream.config.MergableProperties; @@ -189,4 +194,14 @@ public class ProducerProperties implements MergableProperties { this.partitionSelectorName = partitionSelectorName; } + static class ExpressionSerializer extends JsonSerializer { + + @Override + public void serialize(Expression expression, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + throws IOException { + if (expression != null) { + jsonGenerator.writeString(expression.getExpressionString()); + } + } + } } diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/EnvironmentEntryInitializingTreeMap.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/EnvironmentEntryInitializingTreeMap.java index 6f2165a7b..6485d40f7 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/EnvironmentEntryInitializingTreeMap.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/EnvironmentEntryInitializingTreeMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 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. @@ -29,8 +29,6 @@ import org.springframework.core.convert.ConversionService; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.util.Assert; -//import org.springframework.boot.context.properties.bind.convert.BinderConversionService; - /** * A {@link Map} implementation that initializes its entries by binding values from the * supplied environment. Any call to 'get()' will result in either returning the existing diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/MergableProperties.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/MergableProperties.java index 793256f6b..e1742a7ee 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/MergableProperties.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/MergableProperties.java @@ -65,7 +65,6 @@ public interface MergableProperties { Object value = readMethod.invoke(this); if (value != null) { if (value instanceof MergableProperties) { - Object m = readMethod.invoke(mergable); ((MergableProperties)value).merge((MergableProperties)readMethod.invoke(mergable)); } else { diff --git a/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinderTests.java b/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinderTests.java index 5f1be2889..a73fd0ba9 100644 --- a/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinderTests.java +++ b/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinderTests.java @@ -62,7 +62,7 @@ public class AbstractMessageChannelBinderTests { } @Test - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings("unchecked") public void testEndpointLifecycle() throws Exception { AbstractMessageChannelBinder> binder = context.getBean(AbstractMessageChannelBinder.class); @@ -106,7 +106,7 @@ public class AbstractMessageChannelBinderTests { } @Test - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings("unchecked") public void testEndpointBinderHasRecoverer() throws Exception { ConfigurableApplicationContext context = new SpringApplicationBuilder(TestChannelBinderConfiguration.getCompleteConfiguration()).web(WebApplicationType.NONE).run();