diff --git a/spring-cloud-stream-schema/pom.xml b/spring-cloud-stream-schema/pom.xml index 397cb42a3..ed8dc6815 100644 --- a/spring-cloud-stream-schema/pom.xml +++ b/spring-cloud-stream-schema/pom.xml @@ -61,7 +61,6 @@ schema - diff --git a/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/ParsedSchema.java b/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/ParsedSchema.java index c20cac7da..82a5513ff 100644 --- a/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/ParsedSchema.java +++ b/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/ParsedSchema.java @@ -19,12 +19,15 @@ package org.springframework.cloud.stream.schema; import org.apache.avro.Schema; /** - * This class exists to avoid unnecessary parsing of schema textual representation, - * as well as calls to {@link org.apache.avro.Schema} toString method which is very expensive - * due the utilization of {@link com.fasterxml.jackson.databind.ObjectMapper} to output a JSON representation of the schema. + * Stores a {@link Schema} together with its String representation. + * + * Helps to avoid unnecessary parsing of schema textual representation, + * as well as calls to {@link org.apache.avro.Schema} toString method which is very + * expensive due the utilization of {@link com.fasterxml.jackson.databind.ObjectMapper} + * to output a JSON representation of the schema. * * Once a schema is found for any Class, be it a POJO or a {@link org.apache.avro.generic.GenericContainer}, - * both textual representation as well as the {@link org.apache.avro.Schema} will be stored within this class + * both textual representation as well as the {@link org.apache.avro.Schema} will be stored within this class. * * @author Vinicius Carvalho * diff --git a/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/CachingRegistryClient.java b/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/CachingRegistryClient.java index 1f2a93a99..3ba9f9a9b 100644 --- a/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/CachingRegistryClient.java +++ b/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/CachingRegistryClient.java @@ -21,17 +21,18 @@ import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.Cacheable; import org.springframework.cloud.stream.schema.SchemaReference; import org.springframework.cloud.stream.schema.SchemaRegistrationResponse; +import org.springframework.util.Assert; /** * @author Vinicius Carvalho */ public class CachingRegistryClient implements SchemaRegistryClient { - protected static final String CACHE_PREFIX = "org.springframework.cloud.stream.schema.client"; + private static final String CACHE_PREFIX = "org.springframework.cloud.stream.schema.client"; - protected static final String ID_CACHE = CACHE_PREFIX + ".schemaByIdCache"; + private static final String ID_CACHE = CACHE_PREFIX + ".schemaByIdCache"; - protected static final String REF_CACHE = CACHE_PREFIX + ".schemaByReferenceCache"; + private static final String REF_CACHE = CACHE_PREFIX + ".schemaByReferenceCache"; private SchemaRegistryClient delegate; @@ -39,6 +40,7 @@ public class CachingRegistryClient implements SchemaRegistryClient { private CacheManager cacheManager; public CachingRegistryClient(SchemaRegistryClient delegate) { + Assert.notNull(delegate, "The delegate cannot be null"); this.delegate = delegate; } @@ -62,7 +64,4 @@ public class CachingRegistryClient implements SchemaRegistryClient { return delegate.fetch(id); } - public void setDelegate(SchemaRegistryClient delegate) { - this.delegate = delegate; - } } diff --git a/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/config/SchemaRegistryClientConfiguration.java b/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/config/SchemaRegistryClientConfiguration.java index 5eceec876..fc30ef4be 100644 --- a/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/config/SchemaRegistryClientConfiguration.java +++ b/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/config/SchemaRegistryClientConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 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. diff --git a/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/config/SchemaRegistryClientProperties.java b/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/config/SchemaRegistryClientProperties.java index 00c296b25..5924c3c59 100644 --- a/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/config/SchemaRegistryClientProperties.java +++ b/spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/client/config/SchemaRegistryClientProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 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. diff --git a/spring-cloud-stream-schema/src/test/resources/schemas/user.avsc b/spring-cloud-stream-schema/src/test/resources/schemas/user.avsc index f5ef8c98d..662029a22 100644 --- a/spring-cloud-stream-schema/src/test/resources/schemas/user.avsc +++ b/spring-cloud-stream-schema/src/test/resources/schemas/user.avsc @@ -7,4 +7,4 @@ {"name": "favoriteColor", "type": ["string", "null"]} ] -} \ No newline at end of file +}