com.holonplatform.core.query.Query.stream()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中com.holonplatform.core.query.Query.stream方法的一些代码示例,展示了Query.stream的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.stream方法的具体详情如下:
包路径:com.holonplatform.core.query.Query
类名称:Query
方法名:stream

Query.stream介绍

暂无

代码示例

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin-flow

@Override
protected Stream<T> fetchFromBackEnd(Query<T, F> query) {
  return _query(query, true).stream(propertySet).map(item -> itemConverter.apply(item));
}

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin

@Override
protected Stream<T> executeQuery(Query query) {
  return query.stream(BeanProjection.of(beanClass));
}

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin

@Override
protected Stream<PropertyBox> executeQuery(Query query) {
  return query.stream(getPropertySet());
}

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin

@Override
protected Stream<PropertyBox> fetchFromBackEnd(Query<PropertyBox, QueryFilter> query) {
  return buildQuery(query, true).stream(getPropertySet());
}

代码示例来源:origin: com.holon-platform.core/holon-core

@Override
public Stream<T> stream() {
  return getExecutor().stream(BeanProjection.of(getBeanClass()));
}

代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin

@Override
public Stream<PropertyBox> load(QueryConfigurationProvider configuration, int offset, int limit)
    throws DataAccessException {
  Query q = buildQuery(configuration, true);
  // paging
  if (limit > 0) {
    q.limit(limit);
    q.offset(offset);
  }
  // execute
  return q.stream(propertySet);
}

代码示例来源:origin: com.holon-platform.jdbc/documentation-datastore-jdbc

public void orderby() {
  // tag::orderby[]
  QuerySort orderBySort = OrderBySort.create("id asc, name desc"); // <1>
  Stream<Long> results = getDatastore().query().target(TARGET).sort(orderBySort).stream(ID); // <2>
  // end::orderby[]
}

代码示例来源:origin: com.holon-platform.jdbc/documentation-datastore-jdbc

public void where1() {
  // tag::where1[]
  QueryFilter whereFilter = WhereFilter.create("name='John'"); // <1>
  Stream<Long> results = getDatastore().query().target(TARGET).filter(whereFilter).stream(ID); // <2>
  // end::where1[]
}

代码示例来源:origin: com.holon-platform.core/documentation-core

public void distinctProjection() {
  // tag::distinct[]
  final StringProperty PROPERTY = StringProperty.create("test");
  Datastore datastore = getDatastore(); // build or obtain a concrete Datastore implementation
  Stream<String> results = datastore.query(DataTarget.named("test")) //
      .distinct() // <1>
      .stream(PROPERTY);
  // end::distinct[]
}

代码示例来源:origin: com.holon-platform.core/documentation-core

public void beanProjection() {
  final DataTarget<?> TARGET = DataTarget.named("testTarget");
  Datastore datastore = getDatastore(); // build or obtain a concrete Datastore implementation
  Stream<MyBean> results = datastore.query(TARGET).stream(BeanProjection.of(MyBean.class)); // <1>
  Optional<MyBean> result = datastore.query(TARGET).findOne(BeanProjection.of(MyBean.class)); // <2>
  final BeanPropertySet<MyBean> PROPERTIES = BeanPropertySet.create(MyBean.class);
  results = datastore.query(TARGET).stream(BeanProjection.of(MyBean.class, PROPERTIES.property("code"))); // <3>
}
// end::beanprojection[]

代码示例来源:origin: com.holon-platform.core/documentation-core

public void resolver() {
  ExpressionResolver<MyExpression, QuerySort> resolver = ExpressionResolver.create(MyExpression.class, // <2>
      QuerySort.class, (expression, context) -> {
        return Optional.of(QuerySort.asc(SOME_PROPERTY));
      });
  Datastore datastore = getDatastore(); // build or obtain a concrete Datastore implementation
  datastore.addExpressionResolver(resolver); // <3>
  datastore.query().target(DataTarget.named("test")).sort(new MyExpression()).stream(SOME_PROPERTY); // <4>
}
// end::resolver[]

代码示例来源:origin: com.holon-platform.jpa/documentation-datastore-jpa

public void ifnull() {
  // tag::function3[]
  final StringProperty STR = StringProperty.create("stringAttribute");
  final DataTarget<?> TARGET = DataTarget.named("Test");
  Datastore datastore = JpaDatastore.builder() //
      .withExpressionResolver(new TrimResolver()) // <1>
      .build();
  Stream<String> trimmedValues = datastore.query(TARGET).stream(new Trim(STR)); // <2>
  // end::function3[]
}

代码示例来源:origin: com.holon-platform.jdbc/documentation-datastore-jdbc

public void ifnull() {
  // tag::function3[]
  final StringProperty STR = StringProperty.create("str");
  final DataTarget<?> TARGET = DataTarget.named("test");
  Datastore datastore = JdbcDatastore.builder() //
      .withExpressionResolver(new IfNullResolver()) // <1>
      .build();
  Stream<String> values = datastore.query(TARGET).stream(new IfNull<>(STR, "(fallback)")); // <2>
  // end::function3[]
}

代码示例来源:origin: com.holon-platform.core/documentation-core

public void customSort() {
  Datastore datastore = getDatastore(); // build or obtain a concrete Datastore implementation
  datastore.addExpressionResolver(new MySortResolver()); // <4>
  Stream<String> results = datastore.query().target(DataTarget.named("test")).sort(new MySort()).stream(PROPERTY); // <5>
}
// end::customsort[]

代码示例来源:origin: com.holon-platform.core/documentation-core

public void projection2() {
  // tag::projection2[]
  final NumericProperty<Integer> PROPERTY1 = NumericProperty.integerType("test");
  final StringProperty PROPERTY2 = StringProperty.create("test2");
  final DataTarget<?> TARGET = DataTarget.named("testTarget");
  Datastore datastore = getDatastore(); // build or obtain a concrete Datastore implementation
  Optional<Integer> sum = datastore.query(TARGET).findOne(PROPERTY1.sum()); // <1>
  Stream<String> results = datastore.query(TARGET).stream(PROPERTY2.upper()); // <2>
  // end::projection2[]
}

代码示例来源:origin: com.holon-platform.jpa/documentation-datastore-jpa

void operations() {
  // tag::model3[]
  Datastore datastore = getJpaDatastore();
  Stream<Long> ids = datastore.query().target(TARGET).filter(ID.gt(0L)).sort(VALUE.asc()).stream(ID); // <1>
  Stream<PropertyBox> results = datastore.query().target(TARGET).filter(ID.gt(0L)).sort(VALUE.asc()).stream(TEST); // <2>
  PropertyBox valueToSave = PropertyBox.builder(TEST).set(ID, 1L).set(VALUE, "test").build();
  datastore.save(TARGET, valueToSave); // <3>
  // end::model3[]
}

代码示例来源:origin: com.holon-platform.core/documentation-core

public void customFilter() {
  Datastore datastore = getDatastore(); // build or obtain a concrete Datastore implementation
  datastore.addExpressionResolver(new MyFilterResolver()); // <4>
  Stream<String> results = datastore.query().target(DataTarget.named("test"))
      .filter(PROPERTY.isNotNull().and(new MyFilter(PROPERTY, "testValue"))).stream(PROPERTY); // <5>
}
// end::customfilter[]

代码示例来源:origin: com.holon-platform.core/documentation-core

@SuppressWarnings({ "rawtypes", "unchecked" })
public void subquery1() {
  // tag::subquery1[]
  Datastore datastore = getDatastore(); // this is supposed to be a relational Datastore implementation
  final DataTarget TARGET1 = DataTarget.named("testTarget1");
  final PathProperty<Integer> PROPERTY1 = TARGET1.property("test", Integer.class);
  final DataTarget TARGET2 = DataTarget.named("testTarget2");
  final PathProperty<Integer> PROPERTY2 = TARGET2.property("test", Integer.class);
  SubQuery<Integer> subQuery = SubQuery.create().target(TARGET2).filter(PROPERTY1.goe(1)).select(PROPERTY1); // <1>
  Stream<Integer> results = datastore.query().target(TARGET1).filter(PROPERTY2.in(subQuery)).stream(PROPERTY2); // <2>
  // end::subquery1[]
}

代码示例来源:origin: com.holon-platform.jdbc/documentation-datastore-jdbc

public void mapping3() {
  // tag::mapping3[]
  Datastore datastore = JdbcDatastore.builder().dataSource(createOrObtainDatasource()).build(); // <1>
  PropertyBox value = PropertyBox.builder(MyEntity.PROPERTIES) //
      .set(MyEntity.PROPERTIES.property("id"), 1L) //
      .set(MyEntity.PROPERTIES.property("value"), "One").build();
  datastore.save(MyEntity.TARGET, value); // <2>
  Stream<PropertyBox> results = datastore.query().target(MyEntity.TARGET)
      .filter(MyEntity.PROPERTIES.property("id").goe(1L)).stream(MyEntity.PROPERTIES); // <3>
  // end::mapping3[]
}

代码示例来源:origin: com.holon-platform.jdbc/documentation-datastore-jdbc

public void naming2() {
  // tag::naming2[]
  Datastore datastore = JdbcDatastore.builder().dataSource(createOrObtainDatasource()).build(); // <1>
  PropertyBox value = PropertyBox.builder(TEST).set(ID, 1L).set(VALUE, "One").build();
  datastore.save(TARGET, value); // <2>
  Stream<PropertyBox> results = datastore.query().target(TARGET).filter(ID.goe(1L)).stream(TEST); // <3>
  List<String> values = datastore.query().target(TARGET).sort(ID.asc()).list(VALUE); // <4>
  datastore.bulkDelete(TARGET).filter(ID.gt(0L)).execute(); // <5>
  // end::naming2[]
}

相关文章