|
|
|
@ -21,6 +21,7 @@ import org.springframework.data.mapping.model.PropertyValueProvider; |
|
|
|
import org.springframework.data.mapping.model.SpELContext; |
|
|
|
import org.springframework.data.mapping.model.SpELContext; |
|
|
|
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty; |
|
|
|
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty; |
|
|
|
import org.springframework.data.util.TypeInformation; |
|
|
|
import org.springframework.data.util.TypeInformation; |
|
|
|
|
|
|
|
import org.springframework.lang.CheckReturnValue; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -77,6 +78,17 @@ public class MongoConversionContext implements ValueConversionContext<MongoPersi |
|
|
|
return persistentProperty; |
|
|
|
return persistentProperty; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param operatorContext |
|
|
|
|
|
|
|
* @return new instance of {@link MongoConversionContext}. |
|
|
|
|
|
|
|
* @since 4.5 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@CheckReturnValue |
|
|
|
|
|
|
|
public MongoConversionContext forOperator(@Nullable OperatorContext operatorContext) { |
|
|
|
|
|
|
|
return new MongoConversionContext(accessor, persistentProperty, mongoConverter, spELContext, operatorContext); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public Object getValue(String propertyPath) { |
|
|
|
public Object getValue(String propertyPath) { |
|
|
|
return accessor.getPropertyValue(getProperty().getOwner().getRequiredPersistentProperty(propertyPath)); |
|
|
|
return accessor.getPropertyValue(getProperty().getOwner().getRequiredPersistentProperty(propertyPath)); |
|
|
|
@ -123,6 +135,8 @@ public class MongoConversionContext implements ValueConversionContext<MongoPersi |
|
|
|
* @return never {@literal null}. |
|
|
|
* @return never {@literal null}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
String getPath(); |
|
|
|
String getPath(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean isWriteOperation(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static class WriteOperatorContext implements OperatorContext { |
|
|
|
public static class WriteOperatorContext implements OperatorContext { |
|
|
|
@ -142,6 +156,11 @@ public class MongoConversionContext implements ValueConversionContext<MongoPersi |
|
|
|
public String getPath() { |
|
|
|
public String getPath() { |
|
|
|
return path; |
|
|
|
return path; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean isWriteOperation() { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static class QueryOperatorContext implements OperatorContext { |
|
|
|
public static class QueryOperatorContext implements OperatorContext { |
|
|
|
@ -161,5 +180,10 @@ public class MongoConversionContext implements ValueConversionContext<MongoPersi |
|
|
|
public String getPath() { |
|
|
|
public String getPath() { |
|
|
|
return path; |
|
|
|
return path; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean isWriteOperation() { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|