你如何在 Java 中查询对象集合(Criteria/SQL-like)? [英] How do you query object collections in Java (Criteria/SQL-like)?

查看:19
本文介绍了你如何在 Java 中查询对象集合(Criteria/SQL-like)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您有数百个内存对象的集合,并且您需要查询此 List 以返回与某些 SQL 或 Criteria 之类的查询匹配的对象.例如,您可能有一个 Car 对象列表,并且您想要返回 1960 年代制造的所有汽车,其车牌以 AZ 开头,按车型名称排序.

Suppose you have a collection of a few hundred in-memory objects and you need to query this List to return objects matching some SQL or Criteria like query. For example, you might have a List of Car objects and you want to return all cars made during the 1960s, with a license plate that starts with AZ, ordered by the name of the car model.

我知道 JoSQL,有没有人使用过这个,或者对其他/本土解决方案有任何经验?

I know about JoSQL, has anyone used this, or have any experience with other/homegrown solutions?

推荐答案

我用过 Apache Commons JXPath 在生产应用程序中.它允许您将 XPath 表达式应用于 Java 中的对象图.

I have used Apache Commons JXPath in a production application. It allows you to apply XPath expressions to graphs of objects in Java.

这篇关于你如何在 Java 中查询对象集合(Criteria/SQL-like)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆