Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Easy service creation with inferred types

  • Loading branch information...
commit 72893fbaadf35148728d120a40860c6945c5b815 1 parent 54131ce
@ghelmling authored
Showing with 16 additions and 7 deletions.
  1. +7 −7 README.txt
  2. +9 −0 src/java/meetup/beeno/EntityService.java
View
14 README.txt
@@ -1,5 +1,5 @@
=====================
-Meetup.Beeno Overview
+Beeno Overview
=====================
The native Java API for HBase provides fairly low level access to your
@@ -23,7 +23,7 @@ Sample entity class::
/**
* Simple entity class with mapped properties
*/
- @HBaseEntity(name="test_simple")
+ @HEntity(name="test_simple")
public static class SimpleEntity {
String id;
String stringProperty;
@@ -78,7 +78,7 @@ method-level annotations on methods conforming to JavaBeans property
conventions.
-@HBaseEntity( name="*tablename*" )
+@HEntity( name="*tablename*" )
This class-level annotation defines which HBase table is used to store
the entity's data. This is required.
@@ -198,18 +198,18 @@ Some query examples from the feeds implementation.
Find all items related to a discussion::
- FeedItemService service = new FeedItemService(DiscussionItem.class);
+ EntityService<DiscussionItem> service = EntityService.create(DiscussionItem.class);
Query query =
- service.query(DiscussionItem.class)
+ service.query()
.using( Criteria.eq("threadId", threadId) );
List items = query.execute();
Find first 5 greetings from a given member::
- FeedItemService service = new FeedItemService();
+ EntityService<GreetingItem> service = EntityService.create(GreetingItem.class);
Query query =
- service.query(opts)
+ service.query()
.using( Criteria.eq("memberId", memberId) )
.where( Criteria.eq(“itemType”, “chapter_greeting”) )
.limit( 5 );
View
9 src/java/meetup/beeno/EntityService.java
@@ -62,6 +62,15 @@
defaultCollections.put(SortedSet.class, TreeSet.class);
}
+
+ /**
+ * Factory method for easy instantiation without overly verbose java
+ * generics typing.
+ */
+ public static <T> EntityService<T> create(Class<T> itemType) {
+ return new EntityService<T>(itemType);
+ }
+
protected Class<T> clazz;
private EntityInfo defaultInfo;
Please sign in to comment.
Something went wrong with that request. Please try again.