code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
private ParameterValueProvider<ElasticsearchPersistentProperty> getParameterProvider(
ElasticsearchPersistentEntity<?> entity, MapValueAccessor source, ValueExpressionEvaluator evaluator) {
ElasticsearchPropertyValueProvider provider = new ElasticsearchPropertyValueProvider(source, evaluator);
// TODO: Supp... | Reads the given source into the given type.
@param type the type to convert the given source to.
@param source the source to create an object of the given type from.
@return the object that was read | getParameterProvider | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private boolean isAssignedSeqNo(long seqNo) {
return seqNo >= 0;
} | Reads the given source into the given type.
@param type the type to convert the given source to.
@param source the source to create an object of the given type from.
@return the object that was read | isAssignedSeqNo | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private boolean isAssignedPrimaryTerm(long primaryTerm) {
return primaryTerm > 0;
} | Reads the given source into the given type.
@param type the type to convert the given source to.
@param source the source to create an object of the given type from.
@return the object that was read | isAssignedPrimaryTerm | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
protected <R> R readProperties(ElasticsearchPersistentEntity<?> entity, R instance,
ElasticsearchPropertyValueProvider valueProvider) {
PersistentPropertyAccessor<R> accessor = new ConvertingPropertyAccessor<>(entity.getPropertyAccessor(instance),
conversionService);
for (ElasticsearchPersistentPropert... | Reads the given source into the given type.
@param type the type to convert the given source to.
@param source the source to create an object of the given type from.
@return the object that was read | readProperties | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Nullable
protected <R> R readValue(@Nullable Object value, ElasticsearchPersistentProperty property,
TypeInformation<?> type) {
if (value == null) {
return null;
}
Class<?> rawType = type.getType();
if (property.hasPropertyValueConverter()) {
// noinspection unchecked
return (R) proper... | Reads the given source into the given type.
@param type the type to convert the given source to.
@param source the source to create an object of the given type from.
@return the object that was read | readValue | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Nullable
@SuppressWarnings("unchecked")
private <T> T readValue(Object value, TypeInformation<?> type) {
Class<?> rawType = type.getType();
if (conversions.hasCustomReadTarget(value.getClass(), rawType)) {
return (T) conversionService.convert(value, rawType);
} else if (value instanceof List) {
... | Reads the given source into the given type.
@param type the type to convert the given source to.
@param source the source to create an object of the given type from.
@return the object that was read | readValue | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@SuppressWarnings("unchecked")
private static <T> T getCollectionWithSingleElement(TypeInformation<?> collectionType,
TypeInformation<?> componentType, Object element) {
Collection<Object> collection = CollectionFactory.createCollection(collectionType.getType(),
componentType.getType(), 1);
collection.... | Reads the given source into the given type.
@param type the type to convert the given source to.
@param source the source to create an object of the given type from.
@return the object that was read | getCollectionWithSingleElement | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Nullable
TypeInformation<?> getCollectionComponentType(TypeInformation<?> type) {
return type.isCollectionLike() ? type.getComponentType() : null;
} | @param type the type to check
@return the collection type if type is a collection, null otherwise, | getCollectionComponentType | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private Object propertyConverterRead(ElasticsearchPersistentProperty property, Object source) {
PropertyValueConverter propertyValueConverter = Objects.requireNonNull(property.getPropertyValueConverter());
if (source instanceof String[] strings) {
// convert to a List
source = Arrays.asList(strings);
... | @param type the type to check
@return the collection type if type is a collection, null otherwise, | propertyConverterRead | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private Object convertOnRead(PropertyValueConverter propertyValueConverter, Object source) {
return propertyValueConverter.read(source);
} | @param type the type to check
@return the collection type if type is a collection, null otherwise, | convertOnRead | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@SuppressWarnings("unchecked")
@Nullable
private Object readCollectionOrArray(TypeInformation<?> targetType, Collection<?> source) {
Assert.notNull(targetType, "Target type must not be null!");
Class<?> collectionType = targetType.isSubTypeOf(Collection.class) //
? targetType.getType() //
: List.c... | Reads the given {@link Collection} into a collection of the given {@link TypeInformation}.
@param targetType must not be {@literal null}.
@param source must not be {@literal null}.
@return the converted {@link Collection} or array, will never be {@literal null}. | readCollectionOrArray | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Nullable
private Object getPotentiallyConvertedSimpleRead(@Nullable Object value, TypeInformation<?> targetType) {
return getPotentiallyConvertedSimpleRead(value, targetType.getType());
} | Reads the given {@link Collection} into a collection of the given {@link TypeInformation}.
@param targetType must not be {@literal null}.
@param source must not be {@literal null}.
@return the converted {@link Collection} or array, will never be {@literal null}. | getPotentiallyConvertedSimpleRead | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@SuppressWarnings({ "unchecked", "rawtypes" })
@Nullable
private Object getPotentiallyConvertedSimpleRead(@Nullable Object value, @Nullable Class<?> target) {
if (target == null || value == null || ClassUtils.isAssignableValue(target, value)) {
return value;
}
if (conversions.hasCustomReadTarget(valu... | Reads the given {@link Collection} into a collection of the given {@link TypeInformation}.
@param targetType must not be {@literal null}.
@param source must not be {@literal null}.
@return the converted {@link Collection} or array, will never be {@literal null}. | getPotentiallyConvertedSimpleRead | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Nullable
private Object convertFromCollectionToObject(Object value, Class<?> target) {
if (value.getClass().isArray()) {
// noinspection ArraysAsListWithZeroOrOneArgument
value = Arrays.asList(value);
}
if (value instanceof Collection<?> collection && !collection.isEmpty()) {
value = collectio... | we need the conversion from a collection to the first element for example in the case when reading the
constructor parameter of an entity from a scripted return. Originally this was handle in the conversionService,
but will be removed from spring-data-commons, so we do it here | convertFromCollectionToObject | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private <T> void populateScriptedFields(ElasticsearchPersistentEntity<?> entity, T result,
SearchDocument searchDocument) {
Map<String, List<Object>> fields = searchDocument.getFields();
entity.doWithProperties((SimplePropertyHandler) property -> {
if (property.isAnnotationPresent(ScriptedField.class)) {
... | Checks if any of the properties of the entity is annotated with
@{@link ScriptedField}. If so, the value of this property is set from the returned fields in the document.
@param entity the entity to defining the persistent property
@param result the rsult to populate
@param searchDocument the search result caontaining... | populateScriptedFields | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private ElasticsearchPersistentEntity<?> computeClosestEntity(ElasticsearchPersistentEntity<?> entity,
Map<String, Object> source) {
TypeInformation<?> typeToUse = typeMapper.readType(source);
if (typeToUse == null) {
return entity;
}
if (!entity.getTypeInformation().getType().isInterface() && !e... | Compute the type to use by checking the given entity against the store type; | computeClosestEntity | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Override
public <T> T getPropertyValue(ElasticsearchPersistentProperty property) {
String expression = property.getSpelExpression();
Object value = expression != null ? evaluator.evaluate(expression) : accessor.get(property);
if (value == null) {
return null;
}
return readValue(value, pr... | Compute the type to use by checking the given entity against the store type; | getPropertyValue | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Override
protected <T> T potentiallyConvertExpressionValue(Object object,
Parameter<T, ElasticsearchPersistentProperty> parameter) {
return readValue(object, parameter.getType());
} | Creates a new {@link ConverterAwareValueExpressionParameterValueProvider}.
@param evaluator must not be {@literal null}.
@param conversionService must not be {@literal null}.
@param delegate must not be {@literal null}. | potentiallyConvertExpressionValue | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Override
public <T> T getParameterValue(Parameter<T, ElasticsearchPersistentProperty> parameter) {
return null;
} | Creates a new {@link ConverterAwareValueExpressionParameterValueProvider}.
@param evaluator must not be {@literal null}.
@param conversionService must not be {@literal null}.
@param delegate must not be {@literal null}. | getParameterValue | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
void write(Object source, Document sink) {
if (source instanceof Map) {
// noinspection unchecked
sink.putAll((Map<String, Object>) source);
return;
}
Class<?> entityType = ClassUtils.getUserClass(source.getClass());
ElasticsearchPersistentEntity<?> entity = mappingContext.getPersistentEntity(... | Class to do the actual writing. The methods originally were in the MappingElasticsearchConverter class, but are
refactored to allow for keeping state during the conversion of an object. | write | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@SuppressWarnings("unchecked")
private void writeInternal(@Nullable Object source, Map<String, Object> sink,
@Nullable TypeInformation<?> typeInformation) {
if (null == source) {
return;
}
Class<?> entityType = source.getClass();
Optional<Class<?>> customTarget = conversions.getCustomWriteTarget... | Internal write conversion method which should be used for nested invocations.
@param source the object to write
@param sink the destination
@param typeInformation type information for the source | writeInternal | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private void writeInternal(@Nullable Object source, Map<String, Object> sink,
@Nullable ElasticsearchPersistentEntity<?> entity) {
if (source == null) {
return;
}
if (null == entity) {
throw new MappingException("No mapping metadata found for entity of type " + source.getClass().getName());
}
... | Internal write conversion method which should be used for nested invocations.
@param source the object to write
@param sink the destination
@param entity entity for the source | writeInternal | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private boolean requiresTypeHint(Class<?> type) {
return !isSimpleType(type) && !ClassUtils.isAssignable(Collection.class, type)
&& !conversions.hasCustomWriteTarget(type, Document.class);
} | Check if a given type requires a type hint (aka {@literal _class} attribute) when writing to the document.
@param type must not be {@literal null}.
@return {@literal true} if not a simple type, {@link Collection} or type with custom write target. | requiresTypeHint | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private boolean isSimpleType(Object value) {
return isSimpleType(value.getClass());
} | Check if a given type requires a type hint (aka {@literal _class} attribute) when writing to the document.
@param type must not be {@literal null}.
@return {@literal true} if not a simple type, {@link Collection} or type with custom write target. | isSimpleType | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private boolean isSimpleType(Class<?> type) {
return !Map.class.isAssignableFrom(type) && conversions.isSimpleType(type);
} | Check if a given type requires a type hint (aka {@literal _class} attribute) when writing to the document.
@param type must not be {@literal null}.
@return {@literal true} if not a simple type, {@link Collection} or type with custom write target. | isSimpleType | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private Map<String, Object> writeMapInternal(Map<?, ?> source, Map<String, Object> sink,
TypeInformation<?> propertyType) {
for (Map.Entry<?, ?> entry : source.entrySet()) {
Object key = entry.getKey();
Object value = entry.getValue();
if (isSimpleType(key.getClass())) {
String simpleKey = p... | Writes the given {@link Map} to the given {@link Document} considering the given {@link TypeInformation}.
@param source must not be {@literal null}.
@param sink must not be {@literal null}.
@param propertyType must not be {@literal null}. | writeMapInternal | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@SuppressWarnings("unchecked")
private List<Object> writeCollectionInternal(Collection<?> source, @Nullable TypeInformation<?> type,
Collection<?> sink) {
TypeInformation<?> componentType = null;
List<Object> collection = sink instanceof List ? (List<Object>) sink : new ArrayList<>(sink);
if (type != ... | Populates the given {@link Collection sink} with converted values from the given {@link Collection source}.
@param source the collection to create a {@link Collection} for, must not be {@literal null}.
@param type the {@link TypeInformation} to consider or {@literal null} if unknown.
@param sink the {@link Collection}... | writeCollectionInternal | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private void writeProperties(ElasticsearchPersistentEntity<?> entity, PersistentPropertyAccessor<?> accessor,
MapValueAccessor sink) {
for (ElasticsearchPersistentProperty property : entity) {
if (!property.isWritable() //
|| property.isIndexedIndexNameProperty() //
|| (property.isIdProperty() ... | Populates the given {@link Collection sink} with converted values from the given {@link Collection source}.
@param source the collection to create a {@link Collection} for, must not be {@literal null}.
@param type the {@link TypeInformation} to consider or {@literal null} if unknown.
@param sink the {@link Collection}... | writeProperties | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private static boolean hasEmptyValue(Object value) {
return value instanceof String s && s.isEmpty() || value instanceof Collection<?> c && c.isEmpty()
|| value instanceof Map<?, ?> m && m.isEmpty();
} | Populates the given {@link Collection sink} with converted values from the given {@link Collection source}.
@param source the collection to create a {@link Collection} for, must not be {@literal null}.
@param type the {@link TypeInformation} to consider or {@literal null} if unknown.
@param sink the {@link Collection}... | hasEmptyValue | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@SuppressWarnings("unchecked")
protected void writeProperty(ElasticsearchPersistentProperty property, Object value, MapValueAccessor sink) {
Optional<Class<?>> customWriteTarget = conversions.getCustomWriteTarget(value.getClass());
if (customWriteTarget.isPresent()) {
Class<?> writeTarget = customWriteTar... | Populates the given {@link Collection sink} with converted values from the given {@link Collection source}.
@param source the collection to create a {@link Collection} for, must not be {@literal null}.
@param type the {@link TypeInformation} to consider or {@literal null} if unknown.
@param sink the {@link Collection}... | writeProperty | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private void addCustomTypeKeyIfNecessary(Object source, Map<String, Object> sink,
@Nullable TypeInformation<?> type) {
if (!writeTypeHints) {
return;
}
Class<?> reference;
if (type == null) {
reference = Object.class;
} else {
TypeInformation<?> actualType = type.getActualType();
r... | Adds custom typeInformation information to the given {@link Map} if necessary. That is if the value is not the
same as the one given. This is usually the case if you store a subtype of the actual declared typeInformation of
the property.
@param source must not be {@literal null}.
@param sink must not be {@literal null... | addCustomTypeKeyIfNecessary | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private String potentiallyConvertMapKey(Object key) {
if (key instanceof String) {
return (String) key;
}
if (conversions.hasCustomWriteTarget(key.getClass(), String.class)) {
Object potentiallyConvertedSimpleWrite = getPotentiallyConvertedSimpleWrite(key, Object.class);
if (potentiallyConverted... | Returns a {@link String} representation of the given {@link Map} key
@param key the key to convert | potentiallyConvertMapKey | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Nullable
private Object getPotentiallyConvertedSimpleWrite(@Nullable Object value, @Nullable Class<?> typeHint) {
if (value == null) {
return null;
}
if (typeHint != null && Object.class != typeHint) {
if (conversionService.canConvert(value.getClass(), typeHint)) {
value = conversionService.... | Checks whether we have a custom conversion registered for the given value into an arbitrary simple Elasticsearch
type. Returns the converted value if so. If not, we perform special enum handling or simply return the value as
is.
@param value value to convert | getPotentiallyConvertedSimpleWrite | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private Object propertyConverterWrite(ElasticsearchPersistentProperty property, Object value) {
PropertyValueConverter propertyValueConverter = Objects.requireNonNull(property.getPropertyValueConverter());
if (value instanceof List) {
value = ((List<?>) value).stream().map(propertyValueConverter::write).coll... | Checks whether we have a custom conversion registered for the given value into an arbitrary simple Elasticsearch
type. Returns the converted value if so. If not, we perform special enum handling or simply return the value as
is.
@param value value to convert | propertyConverterWrite | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
protected List<Object> createCollection(Collection<?> collection, ElasticsearchPersistentProperty property) {
return writeCollectionInternal(collection, property.getTypeInformation(), new ArrayList<>(collection.size()));
} | Writes the given {@link Collection} using the given {@link ElasticsearchPersistentProperty} information.
@param collection must not be {@literal null}.
@param property must not be {@literal null}. | createCollection | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
protected Map<String, Object> createMap(Map<?, ?> map, ElasticsearchPersistentProperty property) {
Assert.notNull(map, "Given map must not be null!");
Assert.notNull(property, "PersistentProperty must not be null!");
return writeMapInternal(map, new LinkedHashMap<>(map.size()), property.getTypeInformation())... | Writes the given {@link Map} using the given {@link ElasticsearchPersistentProperty} information.
@param map must not {@literal null}.
@param property must not be {@literal null}. | createMap | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private static Collection<?> asCollection(Object source) {
if (source instanceof Collection<?> collection) {
return collection;
}
return source.getClass().isArray() ? CollectionUtils.arrayToList(source) : Collections.singleton(source);
} | Returns given object as {@link Collection}. Will return the {@link Collection} as is if the source is a
{@link Collection} already, will convert an array into a {@link Collection} or simply create a single element
collection for everything else.
@param source object to convert | asCollection | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Override
public void updateQuery(Query query, @Nullable Class<?> domainClass) {
Assert.notNull(query, "query must not be null");
if (query instanceof BaseQuery baseQuery) {
if (baseQuery.queryIsUpdatedByConverter()) {
return;
}
}
if (domainClass == null) {
return;
}
updatePropertiesInFie... | Returns given object as {@link Collection}. Will return the {@link Collection} as is if the source is a
{@link Collection} already, will convert an array into a {@link Collection} or simply create a single element
collection for everything else.
@param source object to convert | updateQuery | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private void updatePropertiesInFieldsSortAndSourceFilter(Query query, Class<?> domainClass) {
ElasticsearchPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(domainClass);
if (persistentEntity != null) {
List<String> fields = query.getFields();
if (!fields.isEmpty()) {
query.setF... | replaces the names of fields in the query, the sort or soucre filters with the field names used in Elasticsearch
when they are defined on the ElasticsearchProperties
@param query the query to process
@param domainClass the domain class (persistent entity) | updatePropertiesInFieldsSortAndSourceFilter | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private List<String> propertyToFieldNames(List<String> propertyNames,
ElasticsearchPersistentEntity<?> persistentEntity) {
return propertyNames.stream().map(propertyName -> propertyToFieldName(persistentEntity, propertyName))
.collect(Collectors.toList());
} | replaces property name of a property of the persistentEntity with the corresponding fieldname. If no such property
exists, the original fieldName is kept.
@param propertyNames list of fieldnames
@param persistentEntity the persistent entity to check
@return an updated list of field names | propertyToFieldNames | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@NotNull
private String propertyToFieldName(ElasticsearchPersistentEntity<?> persistentEntity, String propertyName) {
ElasticsearchPersistentProperty persistentProperty = persistentEntity.getPersistentProperty(propertyName);
return persistentProperty != null ? persistentProperty.getFieldName() : propertyName;
} | replaces property name of a property of the persistentEntity with the corresponding fieldname. If no such property
exists, the original fieldName is kept.
@param propertyNames list of fieldnames
@param persistentEntity the persistent entity to check
@return an updated list of field names | propertyToFieldName | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private void updatePropertiesInCriteriaQuery(CriteriaQuery criteriaQuery, Class<?> domainClass) {
Assert.notNull(criteriaQuery, "criteriaQuery must not be null");
Assert.notNull(domainClass, "domainClass must not be null");
ElasticsearchPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(d... | replaces property name of a property of the persistentEntity with the corresponding fieldname. If no such property
exists, the original fieldName is kept.
@param propertyNames list of fieldnames
@param persistentEntity the persistent entity to check
@return an updated list of field names | updatePropertiesInCriteriaQuery | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private void updatePropertiesInCriteria(Criteria criteria, ElasticsearchPersistentEntity<?> persistentEntity) {
Field field = criteria.getField();
if (field == null) {
return;
}
var propertyNamesUpdate = updatePropertyNames(persistentEntity, field.getName());
var fieldNames = propertyNamesUpdate.names(... | replaces property name of a property of the persistentEntity with the corresponding fieldname. If no such property
exists, the original fieldName is kept.
@param propertyNames list of fieldnames
@param persistentEntity the persistent entity to check
@return an updated list of field names | updatePropertiesInCriteria | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Override
public String updateFieldNames(String propertyPath, ElasticsearchPersistentEntity<?> persistentEntity) {
Assert.notNull(propertyPath, "propertyPath must not be null");
Assert.notNull(persistentEntity, "persistentEntity must not be null");
var propertyNamesUpdate = updatePropertyNames(persistentEntity... | replaces property name of a property of the persistentEntity with the corresponding fieldname. If no such property
exists, the original fieldName is kept.
@param propertyNames list of fieldnames
@param persistentEntity the persistent entity to check
@return an updated list of field names | updateFieldNames | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
PropertyNamesUpdate updatePropertyNames(ElasticsearchPersistentEntity<?> persistentEntity, String propertyPath) {
String[] propertyNames = propertyPath.split("\\.");
String[] fieldNames = Arrays.copyOf(propertyNames, propertyNames.length);
ElasticsearchPersistentEntity<?> currentEntity = persistentEntity;
Ela... | Parse a propertyPath and replace the path values with the field names from a persistentEntity. path entries not
found in the entity are kept as they are.
@return the eventually modified names, a flag if a nested entity was encountered the number of processed
propertiesand the last processed PersistentProperty. | updatePropertyNames | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Nullable
public Object get(ElasticsearchPersistentProperty property) {
String fieldName = property.getFieldName();
if (target instanceof Document document) {
// nested objects may have properties like 'id' which are recognized as isIdProperty() but they are not
// Documents
if (property.isIdProp... | Parse a propertyPath and replace the path values with the field names from a persistentEntity. path entries not
found in the entity are kept as they are.
@return the eventually modified names, a flag if a nested entity was encountered the number of processed
propertiesand the last processed PersistentProperty. | get | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
public void set(ElasticsearchPersistentProperty property, @Nullable Object value) {
if (value != null) {
if (property.isIdProperty()) {
((Document) target).setId(value.toString());
}
if (property.isVersionProperty()) {
((Document) target).setVersion((Long) value);
}
}
target.put(p... | Parse a propertyPath and replace the path values with the field names from a persistentEntity. path entries not
found in the entity are kept as they are.
@return the eventually modified names, a flag if a nested entity was encountered the number of processed
propertiesand the last processed PersistentProperty. | set | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
private Map<String, Object> getAsMap(Object result) {
if (result instanceof Map) {
// noinspection unchecked
return (Map<String, Object>) result;
}
throw new IllegalArgumentException(String.format("%s is not a Map.", result));
} | Parse a propertyPath and replace the path values with the field names from a persistentEntity. path entries not
found in the entity are kept as they are.
@return the eventually modified names, a flag if a nested entity was encountered the number of processed
propertiesand the last processed PersistentProperty. | getAsMap | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java | Apache-2.0 |
@Override
protected String format(Number number) {
return String.valueOf(number);
} | @param property the property this convertrer belongs to
@param genericType the generic type of the Range | format | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/NumberRangePropertyValueConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/NumberRangePropertyValueConverter.java | Apache-2.0 |
@Override
protected Number parse(String value) {
Class<?> type = getGenericType();
if (Integer.class.isAssignableFrom(type)) {
return Integer.valueOf(value);
} else if (Float.class.isAssignableFrom(type)) {
return Float.valueOf(value);
} else if (Long.class.isAssignableFrom(type)) {
return Long.value... | @param property the property this convertrer belongs to
@param genericType the generic type of the Range | parse | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/convert/NumberRangePropertyValueConverter.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/convert/NumberRangePropertyValueConverter.java | Apache-2.0 |
static Document create() {
return new MapDocument();
} | Create a new mutable {@link Document}.
@return a new {@link Document}. | create | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
static Document from(Map<String, ?> map) {
Assert.notNull(map, "Map must not be null");
if (map instanceof LinkedHashMap) {
return new MapDocument(map);
}
return new MapDocument(new LinkedHashMap<>(map));
} | Create a {@link Document} from a {@link Map} containing key-value pairs and sub-documents.
@param map source map containing key-value pairs and sub-documents. must not be {@literal null}.
@return a new {@link Document}. | from | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
static Document parse(String json) {
Assert.notNull(json, "JSON must not be null");
return new MapDocument().fromJson(json);
} | Parse JSON to {@link Document}.
@param json must not be {@literal null}.
@return the parsed {@link Document}. | parse | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
@Override
default Document fromJson(String json) {
Assert.notNull(json, "JSON must not be null");
clear();
try {
putAll(MapDocument.OBJECT_MAPPER.readerFor(Map.class).readValue(json));
} catch (IOException e) {
throw new ConversionException("Cannot parse JSON", e);
}
return this;
} | Parse JSON to {@link Document}.
@param json must not be {@literal null}.
@return the parsed {@link Document}. | fromJson | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default boolean hasId() {
return false;
} | Return {@literal true} if this {@link Document} is associated with an identifier.
@return {@literal true} if this {@link Document} is associated with an identifier, {@literal false} otherwise. | hasId | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
@Nullable
default String getIndex() {
return null;
} | @return the index if this document was retrieved from an index or was just stored.
@since 4.1 | getIndex | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default void setIndex(@Nullable String index) {
throw new UnsupportedOperationException();
} | Sets the index name for this document
@param index index name
<p>
The default implementation throws {@link UnsupportedOperationException}.
@since 4.1 | setIndex | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default String getId() {
throw new UnsupportedOperationException();
} | Retrieve the identifier associated with this {@link Document}.
<p>
The default implementation throws {@link UnsupportedOperationException}. It's recommended to check {@link #hasId()}
prior to calling this method.
@return the identifier associated with this {@link Document}.
@throws IllegalStateException if the underly... | getId | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default void setId(String id) {
throw new UnsupportedOperationException();
} | Set the identifier for this {@link Document}.
<p>
The default implementation throws {@link UnsupportedOperationException}. | setId | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default boolean hasVersion() {
return false;
} | Return {@literal true} if this {@link Document} is associated with a version.
@return {@literal true} if this {@link Document} is associated with a version, {@literal false} otherwise. | hasVersion | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default long getVersion() {
throw new UnsupportedOperationException();
} | Retrieve the version associated with this {@link Document}.
<p>
The default implementation throws {@link UnsupportedOperationException}. It's recommended to check
{@link #hasVersion()} prior to calling this method.
@return the version associated with this {@link Document}.
@throws IllegalStateException if the underlyi... | getVersion | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default void setVersion(long version) {
throw new UnsupportedOperationException();
} | Set the version for this {@link Document}.
<p>
The default implementation throws {@link UnsupportedOperationException}. | setVersion | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default boolean hasSeqNo() {
return false;
} | Return {@literal true} if this {@link Document} is associated with a seq_no.
@return {@literal true} if this {@link Document} is associated with a seq_no, {@literal false} otherwise. | hasSeqNo | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default long getSeqNo() {
throw new UnsupportedOperationException();
} | Retrieve the seq_no associated with this {@link Document}.
<p>
The default implementation throws {@link UnsupportedOperationException}. It's recommended to check
{@link #hasSeqNo()} prior to calling this method.
@return the seq_no associated with this {@link Document}.
@throws IllegalStateException if the underlying i... | getSeqNo | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default void setSeqNo(long seqNo) {
throw new UnsupportedOperationException();
} | Set the seq_no for this {@link Document}.
<p>
The default implementation throws {@link UnsupportedOperationException}. | setSeqNo | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default boolean hasPrimaryTerm() {
return false;
} | Return {@literal true} if this {@link Document} is associated with a primary_term.
@return {@literal true} if this {@link Document} is associated with a primary_term, {@literal false} otherwise. | hasPrimaryTerm | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default long getPrimaryTerm() {
throw new UnsupportedOperationException();
} | Retrieve the primary_term associated with this {@link Document}.
<p>
The default implementation throws {@link UnsupportedOperationException}. It's recommended to check
{@link #hasPrimaryTerm()} prior to calling this method.
@return the primary_term associated with this {@link Document}.
@throws IllegalStateException i... | getPrimaryTerm | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default void setPrimaryTerm(long primaryTerm) {
throw new UnsupportedOperationException();
} | Set the primary_term for this {@link Document}.
<p>
The default implementation throws {@link UnsupportedOperationException}. | setPrimaryTerm | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
default <R> R transform(Function<? super Document, ? extends R> transformer) {
Assert.notNull(transformer, "transformer must not be null");
return transformer.apply(this);
} | This method allows the application of a function to {@code this} {@link Document}. The function should expect a
single {@link Document} argument and produce an {@code R} result.
<p>
Any exception thrown by the function will be propagated to the caller.
@param transformer functional interface to a apply. must not be {@... | transform | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Document.java | Apache-2.0 |
public boolean isMatch() {
return match != null && match;
} | class that holds explanations returned from an Elasticsearch search. Note: the new Elasticsearch client does not
return the match property in search hits anymore, probably because a returned hit always is a match.
@author Peter-Josef Meisch | isMatch | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | Apache-2.0 |
public Double getValue() {
return value;
} | class that holds explanations returned from an Elasticsearch search. Note: the new Elasticsearch client does not
return the match property in search hits anymore, probably because a returned hit always is a match.
@author Peter-Josef Meisch | getValue | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | Apache-2.0 |
@Nullable
public String getDescription() {
return description;
} | class that holds explanations returned from an Elasticsearch search. Note: the new Elasticsearch client does not
return the match property in search hits anymore, probably because a returned hit always is a match.
@author Peter-Josef Meisch | getDescription | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | Apache-2.0 |
public List<Explanation> getDetails() {
return details;
} | class that holds explanations returned from an Elasticsearch search. Note: the new Elasticsearch client does not
return the match property in search hits anymore, probably because a returned hit always is a match.
@author Peter-Josef Meisch | getDetails | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | Apache-2.0 |
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Explanation that = (Explanation) o;
if (match != that.match)
return false;
if (!value.equals(that.value))
return false;
if (!Objects.equals(description, that.desc... | class that holds explanations returned from an Elasticsearch search. Note: the new Elasticsearch client does not
return the match property in search hits anymore, probably because a returned hit always is a match.
@author Peter-Josef Meisch | equals | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | Apache-2.0 |
@Override
public int hashCode() {
int result = (match ? 1 : 0);
result = 31 * result + value.hashCode();
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + details.hashCode();
return result;
} | class that holds explanations returned from an Elasticsearch search. Note: the new Elasticsearch client does not
return the match property in search hits anymore, probably because a returned hit always is a match.
@author Peter-Josef Meisch | hashCode | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | Apache-2.0 |
@Override
public String toString() {
return "Explanation{" + //
"match=" + match + //
", value=" + value + //
", description='" + description + '\'' + //
", details=" + details + //
'}'; //
} | class that holds explanations returned from an Elasticsearch search. Note: the new Elasticsearch client does not
return the match property in search hits anymore, probably because a returned hit always is a match.
@author Peter-Josef Meisch | toString | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/Explanation.java | Apache-2.0 |
@Override
public void setIndex(@Nullable String index) {
this.index = index;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | setIndex | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Nullable
@Override
public String getIndex() {
return index;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | getIndex | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public boolean hasId() {
return this.id != null;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | hasId | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public String getId() {
if (!hasId()) {
throw new IllegalStateException("No Id associated with this Document");
}
return this.id;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | getId | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public void setId(String id) {
this.id = id;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | setId | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public boolean hasVersion() {
return this.version != null;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | hasVersion | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public long getVersion() {
if (!hasVersion()) {
throw new IllegalStateException("No version associated with this Document");
}
return this.version;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | getVersion | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public void setVersion(long version) {
this.version = version;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | setVersion | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public boolean hasSeqNo() {
return this.seqNo != null;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | hasSeqNo | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public long getSeqNo() {
if (!hasSeqNo()) {
throw new IllegalStateException("No seq_no associated with this Document");
}
return this.seqNo;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | getSeqNo | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
public void setSeqNo(long seqNo) {
this.seqNo = seqNo;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | setSeqNo | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public boolean hasPrimaryTerm() {
return this.primaryTerm != null;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | hasPrimaryTerm | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public long getPrimaryTerm() {
if (!hasPrimaryTerm()) {
throw new IllegalStateException("No primary_term associated with this Document");
}
return this.primaryTerm;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | getPrimaryTerm | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
public void setPrimaryTerm(long primaryTerm) {
this.primaryTerm = primaryTerm;
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | setPrimaryTerm | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public int size() {
return documentAsMap.size();
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | size | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public boolean isEmpty() {
return documentAsMap.isEmpty();
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | isEmpty | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public boolean containsKey(Object key) {
return documentAsMap.containsKey(key);
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | containsKey | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public boolean containsValue(Object value) {
return documentAsMap.containsValue(value);
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | containsValue | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public Object get(Object key) {
return documentAsMap.get(key);
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | get | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public Object getOrDefault(Object key, Object defaultValue) {
return documentAsMap.getOrDefault(key, defaultValue);
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | getOrDefault | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public Object put(String key, Object value) {
return documentAsMap.put(key, value);
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | put | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public Object remove(Object key) {
return documentAsMap.remove(key);
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | remove | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public void putAll(Map<? extends String, ?> m) {
documentAsMap.putAll(m);
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | putAll | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
@Override
public void clear() {
documentAsMap.clear();
} | {@link Document} implementation backed by a {@link LinkedHashMap}.
@author Mark Paluch
@author Roman Puchkovskiy
@since 4.0 | clear | java | spring-projects/spring-data-elasticsearch | src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/core/document/MapDocument.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.