JoSQL

JoSQL (SQL for Java Objects) provides the ability for a developer to apply a SQL statement to a collection of Java Objects.
Download

JoSQL Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Gary Bentley
  • Publisher web site:

JoSQL Tags


JoSQL Description

JoSQL (SQL for Java Objects) provides the ability for a developer to apply a SQL statement to a collection of Java Objects. JoSQL (SQL for Java Objects) provides the ability for a developer to apply a SQL statement to a collection of Java Objects. JoSQL provides the ability to search, order and group ANY Java objects and should be applied when you want to perform SQL-like queries on a collection of Java Objects.Example:// Get a list of java.io.File objects. List myObjs = getMyObjects (); // Create a new Query. Query q = new Query (); // Parse the SQL you are going to use, it is assumed here that // "myObjs" contains instances of "java.io.File". q.parse ("SELECT name,length " + "FROM java.io.File " + "WHERE fileExtension (name) = :fileExt " + "ORDER BY length DESC, name " + "EXECUTE ON RESULTS avg (:_allobjs, length) avgLength"); // Set the bind variable "fileExt". q.setVariable ("fileExt", "java"); // Execute the query. QueryResults qr = q.execute (myObjs); // Get the average length, this is a save value, the result // of executing the call "avg (:_allobjs, length)", it is saved against // key: "avgLength". Map saveValues = qr.getSaveValues (); Number avg = (Number) saveValues.get ("avgLength"); // Cycle over the results. List res = qr.getResults (); for (int i = 0; i < res.size (); i++) { // This time there is a List for each row, index 0 holds the name of // the file that matched, index 1 holds the length. List r = (List) res.get (i); System.out.println ("NAME: " + r.get (0)); System.out.println ("LENGTH: " + r.get (1) + ", AVG: " + avg); }What's New in This Release:· Added support for an expression list· New interface for not fixed function results


JoSQL Related Software