DATAREST-1553 - Removed deprecations introduced prior to 3.4.
Removed Java8PluginRegistry not in use anymore anyway. Same for RepositoryRestConfigurerAdapter. Deprecated legacy ResourceMappingUtils and its client code exposed in RepositoryRestConfiguration as it's also not considered anymore.
This commit is contained in:
@@ -378,7 +378,9 @@ public class RepositoryRestConfiguration {
|
||||
*
|
||||
* @param domainType The {@link Class} of the domain type to configure a mapping for.
|
||||
* @return A new {@link ResourceMapping} for configuring how a domain type is mapped.
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public ResourceMapping setResourceMappingForDomainType(Class<?> domainType) {
|
||||
return domainMappings.setResourceMappingFor(domainType);
|
||||
}
|
||||
@@ -388,7 +390,9 @@ public class RepositoryRestConfiguration {
|
||||
*
|
||||
* @param domainType The {@link Class} of the domain type.
|
||||
* @return A {@link ResourceMapping} for that domain type or {@literal null} if none exists.
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public ResourceMapping getResourceMappingForDomainType(Class<?> domainType) {
|
||||
return domainMappings.getResourceMappingFor(domainType);
|
||||
}
|
||||
@@ -398,7 +402,9 @@ public class RepositoryRestConfiguration {
|
||||
*
|
||||
* @param domainType The domain type to find a {@link ResourceMapping} for.
|
||||
* @return {@literal true} if a {@link ResourceMapping} exists for this domain class, {@literal false} otherwise.
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean hasResourceMappingForDomainType(Class<?> domainType) {
|
||||
return domainMappings.hasResourceMappingFor(domainType);
|
||||
}
|
||||
@@ -407,7 +413,9 @@ public class RepositoryRestConfiguration {
|
||||
* Get the {@link ResourceMappingConfiguration} that is currently configured.
|
||||
*
|
||||
* @return
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public ResourceMappingConfiguration getDomainTypesResourceMappingConfiguration() {
|
||||
return domainMappings;
|
||||
}
|
||||
@@ -417,7 +425,9 @@ public class RepositoryRestConfiguration {
|
||||
*
|
||||
* @param repositoryInterface The {@link Class} of the repository interface to configure a mapping for.
|
||||
* @return A new {@link ResourceMapping} for configuring how a repository interface is mapped.
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public ResourceMapping setResourceMappingForRepository(Class<?> repositoryInterface) {
|
||||
return repoMappings.setResourceMappingFor(repositoryInterface);
|
||||
}
|
||||
@@ -427,7 +437,9 @@ public class RepositoryRestConfiguration {
|
||||
*
|
||||
* @param repositoryInterface The {@link Class} of the repository interface.
|
||||
* @return A {@link ResourceMapping} for that repository interface or {@literal null} if none exists.
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public ResourceMapping getResourceMappingForRepository(Class<?> repositoryInterface) {
|
||||
return repoMappings.getResourceMappingFor(repositoryInterface);
|
||||
}
|
||||
@@ -437,11 +449,17 @@ public class RepositoryRestConfiguration {
|
||||
*
|
||||
* @param repositoryInterface
|
||||
* @return
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean hasResourceMappingForRepository(Class<?> repositoryInterface) {
|
||||
return repoMappings.hasResourceMappingFor(repositoryInterface);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public ResourceMapping findRepositoryMappingForPath(String path) {
|
||||
Class<?> type = repoMappings.findTypeForPath(path);
|
||||
if (null == type) {
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.rest.core.support;
|
||||
|
||||
import static org.springframework.data.rest.core.support.ResourceStringUtils.*;
|
||||
import static org.springframework.core.annotation.AnnotationUtils.*;
|
||||
import static org.springframework.data.rest.core.support.ResourceStringUtils.*;
|
||||
import static org.springframework.util.StringUtils.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -34,6 +34,7 @@ import org.springframework.data.rest.core.config.ResourceMapping;
|
||||
* @author Jon Brisbin
|
||||
* @author Florent Biville
|
||||
* @author Oliver Gierke
|
||||
* @deprecated for removal in 3.5
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class ResourceMappingUtils {
|
||||
@@ -77,7 +78,7 @@ public abstract class ResourceMappingUtils {
|
||||
ResourceMapping propertyMapping = entityMapping.getResourceMappingFor(persistentProperty.getName());
|
||||
|
||||
return String.format("%s.%s.%s", repoMapping.getRel(), entityMapping.getRel(),
|
||||
(null != propertyMapping ? propertyMapping.getRel() : persistentProperty.getName()));
|
||||
null != propertyMapping ? propertyMapping.getRel() : persistentProperty.getName());
|
||||
}
|
||||
|
||||
public static String findPath(Class<?> type) {
|
||||
@@ -121,7 +122,7 @@ public abstract class ResourceMappingUtils {
|
||||
return null;
|
||||
}
|
||||
Class<?> repoType = repoInfo.getRepositoryInterface();
|
||||
ResourceMapping mapping = (null != config ? config.getResourceMappingForRepository(repoType) : null);
|
||||
ResourceMapping mapping = null != config ? config.getResourceMappingForRepository(repoType) : null;
|
||||
return merge(repoType, mapping);
|
||||
}
|
||||
|
||||
@@ -131,16 +132,16 @@ public abstract class ResourceMappingUtils {
|
||||
return null;
|
||||
}
|
||||
Class<?> domainType = persistentEntity.getType();
|
||||
ResourceMapping mapping = (null != config ? config.getResourceMappingForDomainType(domainType) : null);
|
||||
ResourceMapping mapping = null != config ? config.getResourceMappingForDomainType(domainType) : null;
|
||||
return merge(domainType, mapping);
|
||||
}
|
||||
|
||||
public static ResourceMapping merge(Method method, ResourceMapping mapping) {
|
||||
ResourceMapping defaultMapping = new ResourceMapping(findRel(method), findPath(method), findExported(method));
|
||||
if (null != mapping) {
|
||||
return new ResourceMapping((null != mapping.getRel() ? mapping.getRel() : defaultMapping.getRel()),
|
||||
(null != mapping.getPath() ? mapping.getPath() : defaultMapping.getPath()),
|
||||
(mapping.isExported() != defaultMapping.isExported() ? mapping.isExported() : defaultMapping.isExported()));
|
||||
return new ResourceMapping(null != mapping.getRel() ? mapping.getRel() : defaultMapping.getRel(),
|
||||
null != mapping.getPath() ? mapping.getPath() : defaultMapping.getPath(),
|
||||
mapping.isExported() != defaultMapping.isExported() ? mapping.isExported() : defaultMapping.isExported());
|
||||
}
|
||||
return defaultMapping;
|
||||
}
|
||||
@@ -148,10 +149,10 @@ public abstract class ResourceMappingUtils {
|
||||
public static ResourceMapping merge(Class<?> type, ResourceMapping mapping) {
|
||||
ResourceMapping defaultMapping = new ResourceMapping(findRel(type), findPath(type), findExported(type));
|
||||
if (null != mapping) {
|
||||
return new ResourceMapping((null != mapping.getRel() ? mapping.getRel() : defaultMapping.getRel()),
|
||||
(null != mapping.getPath() ? mapping.getPath() : defaultMapping.getPath()),
|
||||
(mapping.isExported() != defaultMapping.isExported() ? mapping.isExported() : defaultMapping.isExported()))
|
||||
.addResourceMappings(mapping.getResourceMappings());
|
||||
return new ResourceMapping(null != mapping.getRel() ? mapping.getRel() : defaultMapping.getRel(),
|
||||
null != mapping.getPath() ? mapping.getPath() : defaultMapping.getPath(),
|
||||
mapping.isExported() != defaultMapping.isExported() ? mapping.isExported() : defaultMapping.isExported())
|
||||
.addResourceMappings(mapping.getResourceMappings());
|
||||
}
|
||||
return defaultMapping;
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017-2020 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
|
||||
*
|
||||
* https://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.data.rest.core.util;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.plugin.core.Plugin;
|
||||
import org.springframework.plugin.core.PluginRegistry;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
* @deprecated since 3.2, for removal 3.3.
|
||||
*/
|
||||
@Deprecated
|
||||
public class Java8PluginRegistry<T extends Plugin<S>, S> {
|
||||
|
||||
private final PluginRegistry<T, S> registry;
|
||||
|
||||
public Java8PluginRegistry(PluginRegistry<T, S> registry) {
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
public static <T extends Plugin<S>, S> Java8PluginRegistry<T, S> of(List<? extends T> plugins) {
|
||||
return Java8PluginRegistry.of(PluginRegistry.of(plugins));
|
||||
}
|
||||
|
||||
public static <T extends Plugin<S>, S> Java8PluginRegistry<T, S> of(PluginRegistry<T, S> plugins) {
|
||||
return new Java8PluginRegistry<>(plugins);
|
||||
}
|
||||
|
||||
public static <T extends Plugin<S>, S> Java8PluginRegistry<T, S> empty() {
|
||||
return Java8PluginRegistry.of(Collections.emptyList());
|
||||
}
|
||||
|
||||
public Optional<T> getPluginFor(S delimiter) {
|
||||
return registry.getPluginFor(delimiter);
|
||||
}
|
||||
|
||||
public T getPluginOrDefaultFor(S delimiter, T fallback) {
|
||||
return getPluginFor(delimiter).orElse(fallback);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user