R - Conversion result typepublic interface DocumentConverter<R>
Document instance into a different type.| Modifier and Type | Method and Description |
|---|---|
static <T> DocumentConverter<T> |
bean(com.holonplatform.core.beans.BeanPropertySet<T> beanPropertySet)
Create a new
DocumentConverter to convert documents into Java Bean instances. |
static <T> DocumentConverter<T> |
bean(Class<T> beanClass)
Create a new
DocumentConverter to convert documents into Java Bean instances. |
R |
convert(MongoResolutionContext<?> context,
org.bson.Document document)
Convert a
Document into expected result type. |
static <R> DocumentConverter<R> |
create(Class<R> type,
BiFunction<MongoResolutionContext<?>,org.bson.Document,R> converter)
Create a new
DocumentConverter. |
static <T> DocumentConverter<T> |
expression(com.holonplatform.core.TypedExpression<T> expression,
String selection)
Create a new
DocumentConverter to convert a document field using given expression. |
Class<? extends R> |
getConversionType()
Get the type into which this converter is able to convert a
Document. |
static DocumentConverter<org.bson.Document> |
identity()
Get a
DocumentConverter which simply returns the document instance, without performing any conversion
operation. |
static <P extends com.holonplatform.core.property.Property> |
propertyBox(Iterable<P> properties)
Create a new
DocumentConverter to convert documents into PropertyBox instances using given
property set. |
static <P extends com.holonplatform.core.property.Property> |
propertyBox(P... properties)
Create a new
DocumentConverter to convert documents into PropertyBox instances using given
property set. |
static <T> DocumentConverter<T> |
value(Class<T> valueType,
String selection)
Create a new
DocumentConverter to return a document field without performing any conversion. |
Class<? extends R> getConversionType()
Document.R convert(MongoResolutionContext<?> context, org.bson.Document document)
Document into expected result type.context - Resolution contextdocument - The Document to convertstatic <R> DocumentConverter<R> create(Class<R> type, BiFunction<MongoResolutionContext<?>,org.bson.Document,R> converter)
DocumentConverter.R - Conversion typetype - Conversion type (not null)converter - Conversion function (not null)DocumentConverter instancestatic <P extends com.holonplatform.core.property.Property> DocumentConverter<com.holonplatform.core.property.PropertyBox> propertyBox(Iterable<P> properties)
DocumentConverter to convert documents into PropertyBox instances using given
property set.P - Property typeproperties - The property set to use (not null)PropertyBox type DocumentConverterstatic <P extends com.holonplatform.core.property.Property> DocumentConverter<com.holonplatform.core.property.PropertyBox> propertyBox(P... properties)
DocumentConverter to convert documents into PropertyBox instances using given
property set.P - Property typeproperties - The property set to use (not null)PropertyBox type DocumentConverterstatic <T> DocumentConverter<T> bean(Class<T> beanClass)
DocumentConverter to convert documents into Java Bean instances.T - Bean classbeanClass - Bean class to use (not null)DocumentConverterstatic <T> DocumentConverter<T> bean(com.holonplatform.core.beans.BeanPropertySet<T> beanPropertySet)
DocumentConverter to convert documents into Java Bean instances.T - Bean classbeanPropertySet - Bean property set to use (not null)DocumentConverterstatic <T> DocumentConverter<T> expression(com.holonplatform.core.TypedExpression<T> expression, String selection)
DocumentConverter to convert a document field using given expression.T - Expression typeexpression - Field expressionselection - Field nameDocumentConverterstatic <T> DocumentConverter<T> value(Class<T> valueType, String selection)
DocumentConverter to return a document field without performing any conversion.T - Value typevalueType - Value typeselection - Field nameDocumentConverterstatic DocumentConverter<org.bson.Document> identity()
DocumentConverter which simply returns the document instance, without performing any conversion
operation.Copyright © 2019 The Holon Platform. All rights reserved.