diff --git a/README.md b/README.md index ee93d4d3d4e4436b4bdf79454593d6a326207e12..e4d331d6e541290813522544c967aa3772e7c324 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,6 @@ In untyped mode there is no automatic typing. Whatever class is explicitly indic instantiated when performing queries. Lets start with a simple example domain. public class Person extends VertexFrame { - static final ClassInitializer<Person> DEFAULT_INITIALIZER = - new DefaultClassInitializer(Person.class); - public String getName() { return getProperty("name"); } @@ -77,14 +74,11 @@ instantiated when performing queries. Lets start with a simple example domain. } public Knows addKnows(Person friend) { - return addEdge("knows", friend, Knows.DEFAULT_INITIALIZER); + return addEdge("knows", friend, Knows.class); } } public class Knows extends EdgeFrame { - static final ClassInitializer<Knows> DEFAULT_INITIALIZER = - new DefaultClassInitializer(Knows.class); - public void setYears(int years) { setProperty("years", years); } @@ -102,10 +96,10 @@ And here is how you interact with the framed elements: // implies untyped mode FramedGraph fg = new DelegatingFramedGraph(g); - Person p1 = fg.addFramedVertex(Person.DEFAULT_INITIALIZER); + Person p1 = fg.addFramedVertex(Person.class); p1.setName("Jeff"); - Person p2 = fg.addFramedVertex(Person.DEFAULT_INITIALIZER); + Person p2 = fg.addFramedVertex(Person.class); p2.setName("Julia"); Knows knows = p1.addKnows(p2); knows.setYears(15); @@ -127,8 +121,6 @@ reading from the graph. Say we extend the Person class with the Programmer class. public class Programmer extends Person { - static final ClassInitializer<Programmer> DEFAULT_INITIALIZER = - new DefaultClassInitializer(Programmer.class); } Using simple mode will save the type of Java class the element was created with for use later: @@ -139,10 +131,10 @@ Using simple mode will save the type of Java class the element was created with // implies simple mode FramedGraph fg = new DelegatingFramedGraph(g, true, false); - Person p1 = fg.addFramedVertex(Programmer.DEFAULT_INITIALIZER); + Person p1 = fg.addFramedVertex(Programmer.class); p1.setName("Jeff"); - Person p2 = fg.addFramedVertex(Person.DEFAULT_INITIALIZER); + Person p2 = fg.addFramedVertex(Person.class); p2.setName("Julia"); Person jeff = fg.v().has("name", "Jeff").next(Person.class); @@ -163,9 +155,6 @@ power to determine parent-child relationships at runtime. The same example as above done with annotations would look something like this. public abstract class Person extends VertexFrame { - static final ClassInitializer<Person> DEFAULT_INITIALIZER = - new DefaultClassInitializer(Person.class); - @Property("name") public abstract String getName(); @@ -187,9 +176,6 @@ The same example as above done with annotations would look something like this. } public abstract class Knows extends EdgeFrame { - static final ClassInitializer<Knows> DEFAULT_INITIALIZER = - new DefaultClassInitializer(Knows.class); - @Property("years") public abstract void setYears(int years); @@ -205,8 +191,6 @@ The same example as above done with annotations would look something like this. public abstract class Programmer extends Person { - static final ClassInitializer<Programmer> DEFAULT_INITIALIZER = - new DefaultClassInitializer(Programmer.class); } If we pass a collection of Class objects to the FramedGraph constructor then the annotated type resolver will be used. @@ -223,10 +207,10 @@ construct the byte-code for any abstract annotated methods. //implies annotated mode FramedGraph fg = new DelegatingFramedGraph(g, true, types); - Person p1 = fg.addFramedVertex(Programmer.DEFAULT_INITIALIZER); + Person p1 = fg.addFramedVertex(Programmer.class); p1.setName("Jeff"); - Person p2 = fg.addFramedVertex(Person.DEFAULT_INITIALIZER); + Person p2 = fg.addFramedVertex(Person.class); p2.setName("Julia"); Person jeff = fg.v().has("name", "Jeff").next(Person.class);