クラス BsonUtils
java.lang.ObjectSE
org.springframework.data.mongodb.util.BsonUtils
フィールド概要
フィールドコンストラクター概要
コンストラクター方法の概要
修飾子と型メソッド説明static voidaddAllToMap(Bson target, MapSE<StringSE, ?> source) 指定されたソースMapSE からのすべてのエントリをターゲットに追加します。static voidstatic Bson指定されたソースオブジェクトをBsonとして返します。static CollectionSE<?> asCollection(ObjectSE source) 指定されたオブジェクトをCollectionSE として返します。static DocumentasDocument(@Nullable Bson bson) static DocumentasDocument(@Nullable Bson bson, CodecRegistry codecRegistry) asMap(@Nullable Bson bson, CodecRegistry codecRegistry) static DocumentasMutableDocument(Bson bson) static booleanCheck if a given entry (key/value pair) is present in the givenBson。static <T> @Nullable Tstatic booleanReturns whether the underlyingbsonhas a value (null or non-null) for the givenkey.static booleanstatic booleanisJsonArray(@Nullable StringSE value) Check if a given String looks likeparsablejson array.static booleanisJsonDocument(@Nullable StringSE value) Check if a given String looks likeparsablejson.static DocumentmapEntries(Document source, FunctionSE<Map.EntrySE<StringSE, ObjectSE>, StringSE> keyMapper, FunctionSE<Map.EntrySE<StringSE, ObjectSE>, ObjectSE> valueMapper) static Documentstatic DocumentMerge the givendocumentsinto on in the given order.static Documentparse(StringSE json, @Nullable CodecRegistryProvider codecRegistryProvider) static booleanremoveNullId(Bson bson) Remove_id : nullfrom the givenBsonif present.resolveValue(MapSE<StringSE, ObjectSE> source, StringSE key) 指定されたキーの値を解決します。resolveValue(MapSE<StringSE, ObjectSE> source, FieldName fieldName) 指定されたfield nameの値を解決します。resolveValue(Bson bson, StringSE key) 指定されたキーの値を解決します。resolveValue(Bson bson, FieldName fieldName) 指定されたfield nameの値を解決します。static BsonValuesimpleToBsonValue(@Nullable ObjectSE source) 与えられた単純な値 (例:static BsonValuesimpleToBsonValue(@Nullable ObjectSE source, CodecRegistry codecRegistry) 与えられた単純な値 (例:static booleansupportsBson(ObjectSE source) Returns the given source can be used/converted asBson。static DocumenttoDocumentOrElse(StringSE source, FunctionSE<StringSE, Document> orElse) static ObjectSEtoJavaType(BsonValue value) Extract the corresponding plain value fromBsonValue。Serialize the givenDocumentas Json applying default codecs if necessary.
フィールドの詳細
EMPTY_DOCUMENT
コンストラクターの詳細
BsonUtils
public BsonUtils()
方法の詳細
get
asMap
asMap
Return theBsonobject asMapSE . Depending on the input type, the return value can be either a casted version ofbsonor a converted (detached from the original value) using the givenCodecRegistryto obtaincodecsthat might be required for conversion.asDocument
asDocument
Return theBsonobject asDocument. Depending on the input type, the return value can be either a casted version ofbsonor a converted (detached from the original value) using the givenCodecRegistryto obtaincodecsthat might be required for conversion.- パラメーター:
bson-codecRegistry- null であってはなりません。- 戻り値:
- 決して null にはなりません。
- 導入:
- 4.0
asMutableDocument
addToMap
addAllToMap
contains
removeNullId
toJavaType
- パラメーター:
value- null であってはなりません。- 戻り値:
- 導入:
- 2.1
simpleToBsonValue
- パラメーター:
source- null であってはなりません。- 戻り値:
- the corresponding
BsonValuerepresentation. - 例外:
IllegalArgumentExceptionSE- if source does not correspond to aBsonValuetype.- 導入:
- 3.0
simpleToBsonValue
@Contract("null, _ -> !null") public static BsonValue simpleToBsonValue(@Nullable ObjectSE source, CodecRegistry codecRegistry) - パラメーター:
source- null でもかまいません。codecRegistry- TheCodecRegistryused as a fallback to convert types using nativeCodec. Must not be null.- 戻り値:
- the corresponding
BsonValuerepresentation. - 例外:
IllegalArgumentExceptionSE- if source does not correspond to aBsonValuetype.- 導入:
- 4.2
merge
toDocumentOrElse
- パラメーター:
source-orElse-- 戻り値:
- 導入:
- 2.2
toJson
isJsonDocument
isJsonArray
parse
- パラメーター:
json- null であってはなりません。codecRegistryProvider- can be null. In that case the defaultDocumentCodecis used.- 戻り値:
- 決して null にはなりません。
- 例外:
IllegalArgumentExceptionSE- 必要な引数が null の場合。- 導入:
- 3.0
resolveValue
指定されたキーの値を解決します。指定されたBson値にキーが含まれている場合は、その値がすぐに返されます。キーにドット (.) 表記を使用したパスが含まれている場合は、個々の部分をインスペクションしてパスを解決しようとします。中間の 1 つが null であるか、それ以上インスペクションできない (間違った) 型の場合は、null が返されます。- パラメーター:
bson- インスペクションするソース。null にすることはできません。key- 検索するキー。null にすることはできません。- 戻り値:
- null でもかまいません。
- 導入:
- 3.0.8
resolveValue
Resolve the value for a givenfield name. If the given name is aFieldName.Type.KEYthe value is obtained from the targetBsonimmediately. If the given fieldName is aFieldName.Type.PATHmaybe using the dot (.) notation it will try to resolve the path by inspecting the individual parts. If one of the intermediate ones is null or cannot be inspected further (wrong) type, null is returned.- パラメーター:
bson- インスペクションするソース。null にすることはできません。fieldName- 検索する名前。null にすることはできません。- 戻り値:
- null でもかまいません。
- 導入:
- 4.2
resolveValue
Resolve the value for a givenfield name. If the given name is aFieldName.Type.KEYthe value is obtained from the targetBsonimmediately. If the given fieldName is aFieldName.Type.PATHmaybe using the dot (.) notation it will try to resolve the path by inspecting the individual parts. If one of the intermediate ones is null or cannot be inspected further (wrong) type, null is returned.- パラメーター:
source- インスペクションするソース。null にすることはできません。fieldName- 検索するキー。null にすることはできません。- 戻り値:
- null でもかまいません。
- 導入:
- 4.2
resolveValue
指定されたキーの値を解決します。指定されたMapSE 値にキーが含まれている場合は、その値がすぐに返されます。キーにドット (.) 表記を使用したパスが含まれている場合は、個々の部分をインスペクションしてパスを解決しようとします。中間の 1 つが null であるか、それ以上インスペクションできない (間違った) 型の場合は、null が返されます。- パラメーター:
source- インスペクションするソース。null にすることはできません。key- 検索するキー。null にすることはできません。- 戻り値:
- null でもかまいません。
- 導入:
- 4.1
hasValue
hasValue
asBson
Returns the given source object asBson, i.e.Documents and maps as is or throwIllegalArgumentExceptionSE。- パラメーター:
source-- 戻り値:
- 変換 / キャストされたソースオブジェクト。
- 例外:
IllegalArgumentExceptionSE- ifsourcecannot be converted/cast toBson。- 導入:
- 3.2.3
- 関連事項:
supportsBson
asCollection
指定されたオブジェクトをCollectionSE として返します。ソースがすでにCollectionSE である場合はCollectionSE をそのまま返し、配列をCollectionSE に変換するか、それ以外の場合は単に単一要素のコレクションを作成します。- パラメーター:
source- null であってはなりません。- 戻り値:
- 決して null にはなりません。
- 導入:
- 3.2
mapValues
mapEntries
public static Document mapEntries(Document source, FunctionSE<Map.EntrySE<StringSE, ObjectSE>, StringSE> keyMapper, FunctionSE<Map.EntrySE<StringSE, ObjectSE>, ObjectSE> valueMapper)