|
|
|
@ -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 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|