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

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

问题描述

假设您有几百个内存中对象的集合,并且您需要查询此列表以返回与某些SQL或条件(如查询)匹配的对象。例如,您可能有一个汽车对象列表,并且您想返回在20世纪60年代制造的所有汽车,其牌照以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 ,有人使用过

推荐答案

我使用了 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中查询对象集合(标准/类似SQL)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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