本文整理汇总了Java中org.springframework.data.repository.core.EntityMetadata类的典型用法代码示例。如果您正苦于以下问题:Java EntityMetadata类的具体用法?Java EntityMetadata怎么用?Java EntityMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityMetadata类属于org.springframework.data.repository.core包,在下文中一共展示了EntityMetadata类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntityInformation
import org.springframework.data.repository.core.EntityMetadata; //导入依赖的package包/类
@Override
public EntityMetadata<?> getEntityInformation() {
final Class<?> domainClass = getDomainClass();
final DocumentDbEntityInformation<Object, String> entityInformation =
new DocumentDbEntityInformation(domainClass);
this.metadata = new SimpleDocumentDbEntityMetadata<Object>((Class<Object>) domainClass, entityInformation);
return this.metadata;
}
示例2: renderQueryIfExpressionOrReturnQuery
import org.springframework.data.repository.core.EntityMetadata; //导入依赖的package包/类
/**
* @param query, the query expression potentially containing a SpEL expression. Must not be {@literal null}.}
* @param metadata the {@link EntityMetadata} for the given entity. Must not be {@literal null}.
* @param parser Must not be {@literal null}.
* @return
*/
private static String renderQueryIfExpressionOrReturnQuery(String query, EntityMetadata<?> metadata,
SpelExpressionParser parser) {
Assert.notNull(query, "query must not be null!");
Assert.notNull(metadata, "metadata must not be null!");
Assert.notNull(parser, "parser must not be null!");
if (!containsExpression(query)) {
return query;
}
StandardEvaluationContext evalContext = new StandardEvaluationContext();
evalContext.setVariable(ENTITY_NAME, metadata.getJavaType().getName());
query = potentiallyQuoteExpressionsParameter(query);
Expression expr = parser.parseExpression(query, ParserContext.TEMPLATE_EXPRESSION);
String result = expr.getValue(evalContext, String.class);
if (result == null) {
return query;
}
return potentiallyUnquoteParameterExpressions(result);
}
示例3: executeFind
import org.springframework.data.repository.core.EntityMetadata; //导入依赖的package包/类
@Override
protected FacetPage<?> executeFind(Query query) {
Assert.isInstanceOf(FacetQuery.class, query);
EntityMetadata<?> metadata = solrQueryMethod.getEntityInformation();
return solrOperations.queryForFacetPage((FacetQuery) query, metadata.getJavaType());
}
示例4: execute
import org.springframework.data.repository.core.EntityMetadata; //导入依赖的package包/类
@Override
public Object execute(Query query) {
EntityMetadata<?> metadata = solrQueryMethod.getEntityInformation();
return solrOperations.queryForObject(query, metadata.getJavaType());
}
示例5: ExpressionBasedStringQuery
import org.springframework.data.repository.core.EntityMetadata; //导入依赖的package包/类
/**
* Creates a new {@link ExpressionBasedStringQuery} for the given query and {@link EntityMetadata}.
*
* @param query must not be {@literal null} or empty.
* @param metadata must not be {@literal null}.
* @param parser must not be {@literal null}.
*/
public ExpressionBasedStringQuery(String query, EntityMetadata<?> metadata, SpelExpressionParser parser) {
super(renderQueryIfExpressionOrReturnQuery(query, metadata, parser));
}