Created
November 13, 2012 06:43
-
-
Save FredrikWendt/4064351 to your computer and use it in GitHub Desktop.
Fluent APIs example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fluent; | |
public class ObjectWikiExample { | |
public void someMethod(ObjectWikiDatabaseConnection databaseConnection) { | |
List<Books> books = FromDatabase(dbConn).select(Book.class).with("cover", equal("red")).with("author", like("%Wendt")).fetchAll(); | |
for (Book book : books) { | |
System.out.println(book); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package traditional.generics; | |
public class ObjectWikiExample { | |
public void someMethod(ObjectWikiDatabaseConnection databaseConnection) { | |
ObjectWikiQuery<Book> query = databaseConnection.createQuery(Book.class); | |
query.addConstraint("cover", "red"); | |
query.addConstraint("author", "%Wendt"); | |
List<Book> books = query.fetchAll(); | |
for (Book book : books) { | |
System.out.println(book); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package traditional.raw; | |
public class ObjectWikiExample { | |
public void someMethod(ObjectWikiDatabaseConnection databaseConnection) { | |
ObjectWikiQuery query = databaseConnection.createQuery(); | |
query.setType("book"); | |
query.addConstraint("cover", "red"); | |
query.addConstraint("author", "%Wendt"); | |
List<Book> books = (List<Book>) query.fetchAll(); | |
for (Book book : books) { | |
System.out.println(book); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment