public static class StringOperators.ReplaceOne extends Object
AggregationExpression
for $replaceOne
which replaces the first instance of a search string in an
input string with a replacement string. Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractAggregationExpression.Expand
Expand a nested list of values to single entries or keep the list.
|
Modifier | Constructor and Description |
---|---|
protected |
ReplaceOne(Object value) |
Modifier and Type | Method and Description |
---|---|
protected List<Object> |
append(Object value) |
protected List<Object> |
append(Object value,
AbstractAggregationExpression.Expand expandList) |
protected Map<String,Object> |
append(String key,
Object value) |
protected Map<String,Object> |
appendAt(int index,
String key,
Object value)
Append the given key at the position in the underlying
LinkedHashMap . |
protected Map<String,Object> |
argumentMap()
Get the argument map.
|
protected static List<Field> |
asFields(String... fieldRefs) |
protected boolean |
contains(Object key)
Check if the given key is available.
|
StringOperators.ReplaceOne |
find(String value)
The string to search for within the given input field.
|
StringOperators.ReplaceOne |
findValueOf(AggregationExpression expression)
Specify the
AggregationExpression evaluating to the the string to search for within the given input
field. |
StringOperators.ReplaceOne |
findValueOf(String fieldReference)
Specify the reference to the
field holding the string to search for within the given input field. |
protected <T> T |
get(int index)
Get the value at a given index.
|
protected <T> T |
get(Object key)
Get the value for a given key.
|
protected String |
getMongoMethod() |
protected Map<String,Object> |
remove(String key) |
StringOperators.ReplaceOne |
replacement(String replacement)
The string to use to replace the first matched instance of
find in input. |
StringOperators.ReplaceOne |
replacementOf(AggregationExpression expression)
Specifies the
AggregationExpression evaluating to the string to use to replace the first matched instance
of find in input . |
StringOperators.ReplaceOne |
replacementOf(String fieldReference)
Specifies the reference to the
field holding the string to use to replace the first matched
instance of find in input. |
org.bson.Document |
toDocument(AggregationOperationContext context)
|
org.bson.Document |
toDocument(Object value,
AggregationOperationContext context) |
static StringOperators.ReplaceOne |
value(String value)
Creates new
StringOperators.ReplaceOne using the given as input. |
static StringOperators.ReplaceOne |
valueOf(AggregationExpression expression)
Creates new
StringOperators.ReplaceOne using the result of the provided AggregationExpression as input
value. |
static StringOperators.ReplaceOne |
valueOf(String fieldReference)
Creates new
StringOperators.ReplaceOne using the value of the provided fieldReference as input
value. |
protected List<Object> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
from, toDocument
create, create
protected ReplaceOne(Object value)
public static StringOperators.ReplaceOne value(String value)
StringOperators.ReplaceOne
using the given as input.value
- must not be null.StringOperators.ReplaceOne
.public static StringOperators.ReplaceOne valueOf(String fieldReference)
StringOperators.ReplaceOne
using the value of the provided fieldReference
as input
value.fieldReference
- must not be null.StringOperators.ReplaceOne
.public static StringOperators.ReplaceOne valueOf(AggregationExpression expression)
StringOperators.ReplaceOne
using the result of the provided AggregationExpression
as input
value.expression
- must not be null.StringOperators.ReplaceOne
.public StringOperators.ReplaceOne replacement(String replacement)
find
in input.replacement
- must not be null.StringOperators.ReplaceOne
.public StringOperators.ReplaceOne replacementOf(String fieldReference)
field
holding the string to use to replace the first matched
instance of find
in input.fieldReference
- must not be null.StringOperators.ReplaceOne
.public StringOperators.ReplaceOne replacementOf(AggregationExpression expression)
AggregationExpression
evaluating to the string to use to replace the first matched instance
of find
in input
.expression
- must not be null.StringOperators.ReplaceOne
.public StringOperators.ReplaceOne find(String value)
value
- must not be null.StringOperators.ReplaceOne
.public StringOperators.ReplaceOne findValueOf(String fieldReference)
field
holding the string to search for within the given input field.fieldReference
- must not be null.StringOperators.ReplaceOne
.public StringOperators.ReplaceOne findValueOf(AggregationExpression expression)
AggregationExpression
evaluating to the the string to search for within the given input
field.expression
- must not be null.StringOperators.ReplaceOne
.protected String getMongoMethod()
public org.bson.Document toDocument(AggregationOperationContext context)
AggregationExpression
toDocument
in interface AggregationExpression
context
- must not be null.Document
) form of the expression.public org.bson.Document toDocument(Object value, AggregationOperationContext context)
protected List<Object> append(Object value, AbstractAggregationExpression.Expand expandList)
protected Map<String,Object> appendAt(int index, String key, Object value)
LinkedHashMap
.index
- key
- value
- protected <T> T get(int index)
T
- index
- protected <T> T get(Object key)
T
- key
- protected boolean contains(Object key)
key
- Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.