Browse Source

DATACMNS-1438 - Polishing.

pull/351/head
Oliver Drotbohm 7 years ago
parent
commit
48f468c0b5
No known key found for this signature in database
GPG Key ID: 6E42B5787543F690
  1. 8
      src/main/java/org/springframework/data/mapping/PersistentPropertyPaths.java
  2. 40
      src/main/java/org/springframework/data/mapping/context/PersistentPropertyPathFactory.java

8
src/main/java/org/springframework/data/mapping/PersistentPropertyPaths.java

@ -22,7 +22,7 @@ import org.springframework.data.util.Streamable;
/** /**
* A wrapper for a collection of {@link PersistentPropertyPath}s. * A wrapper for a collection of {@link PersistentPropertyPath}s.
* *
* @author Oliver Gierke * @author Oliver Gierke
* @since 2.1 * @since 2.1
* @soundtrack Stuart McCallum - North Star (City) * @soundtrack Stuart McCallum - North Star (City)
@ -32,14 +32,14 @@ public interface PersistentPropertyPaths<T, P extends PersistentProperty<P>>
/** /**
* Returns the first {@link PersistentPropertyPath}. * Returns the first {@link PersistentPropertyPath}.
* *
* @return * @return
*/ */
Optional<PersistentPropertyPath<P>> getFirst(); Optional<PersistentPropertyPath<P>> getFirst();
/** /**
* Returns whether the given path is contained in the current {@link PersistentPropertyPaths}. * Returns whether the given path is contained in the current {@link PersistentPropertyPaths}.
* *
* @param path must not be {@literal null}. * @param path must not be {@literal null}.
* @return * @return
*/ */
@ -47,7 +47,7 @@ public interface PersistentPropertyPaths<T, P extends PersistentProperty<P>>
/** /**
* Returns whether the given {@link PropertyPath} is contained in the current {@link PersistentPropertyPaths}. * Returns whether the given {@link PropertyPath} is contained in the current {@link PersistentPropertyPaths}.
* *
* @param path must not be {@literal null}. * @param path must not be {@literal null}.
* @return * @return
*/ */

40
src/main/java/org/springframework/data/mapping/context/PersistentPropertyPathFactory.java

@ -20,17 +20,7 @@ import lombok.RequiredArgsConstructor;
import lombok.ToString; import lombok.ToString;
import lombok.Value; import lombok.Value;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -54,7 +44,7 @@ import org.springframework.util.StringUtils;
/** /**
* A factory implementation to create {@link PersistentPropertyPath} instances in various ways. * A factory implementation to create {@link PersistentPropertyPath} instances in various ways.
* *
* @author Oliver Gierke * @author Oliver Gierke
* @since 2.1 * @since 2.1
* @soundtrack Cypress Hill - Boom Biddy Bye Bye (Fugees Remix, Unreleased & Revamped) * @soundtrack Cypress Hill - Boom Biddy Bye Bye (Fugees Remix, Unreleased & Revamped)
@ -69,7 +59,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Creates a new {@link PersistentPropertyPath} for the given property path on the given type. * Creates a new {@link PersistentPropertyPath} for the given property path on the given type.
* *
* @param type must not be {@literal null}. * @param type must not be {@literal null}.
* @param propertyPath must not be {@literal null}. * @param propertyPath must not be {@literal null}.
* @return * @return
@ -84,7 +74,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Creates a new {@link PersistentPropertyPath} for the given property path on the given type. * Creates a new {@link PersistentPropertyPath} for the given property path on the given type.
* *
* @param type must not be {@literal null}. * @param type must not be {@literal null}.
* @param propertyPath must not be {@literal null}. * @param propertyPath must not be {@literal null}.
* @return * @return
@ -99,7 +89,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Creates a new {@link PersistentPropertyPath} for the given {@link PropertyPath}. * Creates a new {@link PersistentPropertyPath} for the given {@link PropertyPath}.
* *
* @param path must not be {@literal null}. * @param path must not be {@literal null}.
* @return * @return
*/ */
@ -113,7 +103,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Creates a new {@link PersistentPropertyPath} based on a given type and {@link Predicate} to select properties * Creates a new {@link PersistentPropertyPath} based on a given type and {@link Predicate} to select properties
* matching it. * matching it.
* *
* @param type must not be {@literal null}. * @param type must not be {@literal null}.
* @param propertyFilter must not be {@literal null}. * @param propertyFilter must not be {@literal null}.
* @return * @return
@ -129,7 +119,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Creates a new {@link PersistentPropertyPath} based on a given type and {@link Predicate} to select properties * Creates a new {@link PersistentPropertyPath} based on a given type and {@link Predicate} to select properties
* matching it. * matching it.
* *
* @param type must not be {@literal null}. * @param type must not be {@literal null}.
* @param propertyFilter must not be {@literal null}. * @param propertyFilter must not be {@literal null}.
* @param traversalGuard must not be {@literal null}. * @param traversalGuard must not be {@literal null}.
@ -148,7 +138,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Creates a new {@link PersistentPropertyPath} based on a given type and {@link Predicate} to select properties * Creates a new {@link PersistentPropertyPath} based on a given type and {@link Predicate} to select properties
* matching it. * matching it.
* *
* @param type must not be {@literal null}. * @param type must not be {@literal null}.
* @param propertyFilter must not be {@literal null}. * @param propertyFilter must not be {@literal null}.
* @return * @return
@ -160,7 +150,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Creates a new {@link PersistentPropertyPath} based on a given type and {@link Predicate} to select properties * Creates a new {@link PersistentPropertyPath} based on a given type and {@link Predicate} to select properties
* matching it. * matching it.
* *
* @param type must not be {@literal null}. * @param type must not be {@literal null}.
* @param propertyFilter must not be {@literal null}. * @param propertyFilter must not be {@literal null}.
* @param traversalGuard must not be {@literal null}. * @param traversalGuard must not be {@literal null}.
@ -297,7 +287,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Creates a new {@link DefaultPersistentPropertyPaths} instance * Creates a new {@link DefaultPersistentPropertyPaths} instance
* *
* @param type * @param type
* @param paths * @param paths
* @return * @return
@ -312,7 +302,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
return new DefaultPersistentPropertyPaths<>(type, sorted); return new DefaultPersistentPropertyPaths<>(type, sorted);
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.springframework.data.mapping.PersistentPropertyPaths#getFirst() * @see org.springframework.data.mapping.PersistentPropertyPaths#getFirst()
*/ */
@ -321,7 +311,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
return isEmpty() ? Optional.empty() : Optional.of(iterator().next()); return isEmpty() ? Optional.empty() : Optional.of(iterator().next());
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.springframework.data.mapping.PersistentPropertyPaths#contains(java.lang.String) * @see org.springframework.data.mapping.PersistentPropertyPaths#contains(java.lang.String)
*/ */
@ -330,7 +320,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
return contains(PropertyPath.from(path, type)); return contains(PropertyPath.from(path, type));
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.springframework.data.mapping.PersistentPropertyPaths#contains(org.springframework.data.mapping.PropertyPath) * @see org.springframework.data.mapping.PersistentPropertyPaths#contains(org.springframework.data.mapping.PropertyPath)
*/ */
@ -348,7 +338,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
return stream().anyMatch(it -> dotPath.equals(it.toDotPath())); return stream().anyMatch(it -> dotPath.equals(it.toDotPath()));
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see java.lang.Iterable#iterator() * @see java.lang.Iterable#iterator()
*/ */
@ -376,7 +366,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
/** /**
* Simple {@link Comparator} to sort {@link PersistentPropertyPath} instances by their property segment's name * Simple {@link Comparator} to sort {@link PersistentPropertyPath} instances by their property segment's name
* length. * length.
* *
* @author Oliver Gierke * @author Oliver Gierke
* @since 2.1 * @since 2.1
*/ */

Loading…
Cancel
Save