Skip to content

Commit a5c8553

Browse files
committed
Added more docs.
1 parent 54985d8 commit a5c8553

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/main/java/com/tinkerpop/frames/modules/javahandler/JavaHandlerFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@
88

99
/**
1010
* {@link JavaHandlerModule} uses this interface to create the concrete classes that will handle the method calls.
11+
* Typically factories will use method.getDeclaringClass() to obtain the concrete class that is being called.
1112
* @author Bryn Cooke
1213
*/
1314
public interface JavaHandlerFactory {
15+
/**
16+
* @param graph The graph of the framed element
17+
* @param element The element being handled
18+
* @param method The method called
19+
* @param direction The drection of the edge if applicable
20+
* @return An object that contains the method being called.
21+
*/
1422
public <T> T create(FramedGraph<?> graph, Element element, Method method, Direction direction);
1523
}

src/main/java/com/tinkerpop/frames/modules/javahandler/JavaHandlerModule.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class JavaHandlerModule implements Module {
4141

4242
private JavaHandlerFactory factory = new JavaHandlerFactory() {
4343

44-
44+
//We don't want to use the global class cache. Instead we cache the classes at the module level.
4545
private LoadingCache<Class<?>, Class<?>> classCache = CacheBuilder.newBuilder().build(
4646
new CacheLoader<Class<?>, Class<?>>() {
4747

@@ -65,11 +65,10 @@ public <T> T create(final FramedGraph<?> graph, final Element element, final Met
6565

6666
try {
6767
final Class<?> frameClass = method.getDeclaringClass();
68-
Class<?> returnType = method.getReturnType();
6968
Class<T> implClass = (Class<T>) classCache.get(frameClass);
7069
T handler = implClass.newInstance();
7170
((Proxy) handler).setHandler(new MethodHandler() {
72-
private DefaultJavaHandlerImpl defaultJavahandlerImpl = new DefaultJavaHandlerImpl(graph, method, element);
71+
private DefaultJavaHandlerImpl<Element> defaultJavahandlerImpl = new DefaultJavaHandlerImpl<Element>(graph, method, element);
7372
private Object framedElement;
7473

7574
@Override

0 commit comments

Comments
 (0)