@ -31,7 +31,7 @@ import org.springframework.lang.Nullable;
* { @link AggregationOperationContext } implementation prefixing non - command keys on root level with the given prefix .
* { @link AggregationOperationContext } implementation prefixing non - command keys on root level with the given prefix .
* Useful when mapping fields to domain specific types while having to prefix keys for query purpose .
* Useful when mapping fields to domain specific types while having to prefix keys for query purpose .
* < p / >
* < p / >
* Fields to be excluded from prefixing my be added to a { @literal black list} .
* Fields to be excluded from prefixing my be added to a { @literal deny list} .
*
*
* @author Christoph Strobl
* @author Christoph Strobl
* @author Mark Paluch
* @author Mark Paluch
@ -41,18 +41,18 @@ public class PrefixingDelegatingAggregationOperationContext implements Aggregati
private final AggregationOperationContext delegate ;
private final AggregationOperationContext delegate ;
private final String prefix ;
private final String prefix ;
private final Set < String > black list;
private final Set < String > deny list;
public PrefixingDelegatingAggregationOperationContext ( AggregationOperationContext delegate , String prefix ) {
public PrefixingDelegatingAggregationOperationContext ( AggregationOperationContext delegate , String prefix ) {
this ( delegate , prefix , Collections . emptySet ( ) ) ;
this ( delegate , prefix , Collections . emptySet ( ) ) ;
}
}
public PrefixingDelegatingAggregationOperationContext ( AggregationOperationContext delegate , String prefix ,
public PrefixingDelegatingAggregationOperationContext ( AggregationOperationContext delegate , String prefix ,
Collection < String > black list) {
Collection < String > deny list) {
this . delegate = delegate ;
this . delegate = delegate ;
this . prefix = prefix ;
this . prefix = prefix ;
this . black list = new HashSet < > ( black list) ;
this . deny list = new HashSet < > ( deny list) ;
}
}
/ *
/ *
@ -121,7 +121,7 @@ public class PrefixingDelegatingAggregationOperationContext implements Aggregati
}
}
private String prefixKey ( String key ) {
private String prefixKey ( String key ) {
return ( key . startsWith ( "$" ) | | isBlacklist ed ( key ) ) ? key : ( prefix + "." + key ) ;
return ( key . startsWith ( "$" ) | | isDeni ed ( key ) ) ? key : ( prefix + "." + key ) ;
}
}
private Object prefixCollection ( Collection < Object > sourceCollection ) {
private Object prefixCollection ( Collection < Object > sourceCollection ) {
@ -139,9 +139,9 @@ public class PrefixingDelegatingAggregationOperationContext implements Aggregati
return prefixed ;
return prefixed ;
}
}
private boolean isBlacklist ed ( String key ) {
private boolean isDeni ed ( String key ) {
if ( black list. contains ( key ) ) {
if ( deny list. contains ( key ) ) {
return true ;
return true ;
}
}
@ -149,8 +149,8 @@ public class PrefixingDelegatingAggregationOperationContext implements Aggregati
return false ;
return false ;
}
}
for ( String blacklisted : black list) {
for ( String denied : deny list) {
if ( key . startsWith ( blacklist ed + "." ) ) {
if ( key . startsWith ( deni ed + "." ) ) {
return true ;
return true ;
}
}
}
}