-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassCastException: Employee$ByteBuddy$Yxytgyif cannot be cast to com.syncleus.ferma.AbstractElementFrame #12
Comments
This is because your Frame is a class but implements the interface VertexFrame. That is not allowed. You have two ways in which you can resolve this:
public class FermaTest {
public interface Employee implements VertexFrame {
@Property("name")
String getName();
@Property("name")
void setName(String name);
}
@Test
public void testCreation() {
Set<Class<?>> types = new HashSet<>(Arrays.asList(new Class<?>[]{Employee.class}));
Graph g = TinkerGraph.open();
//implies annotated mode
FramedGraph fg = new DelegatingFramedGraph(g, true, types);
Employee e1 = fg.addFramedVertex(Employee.class);
e1.setName("Jeff");
}
}
public class FermaTest {
public static abstract class Employee implements AbstractVertexFrame {
@Property("name")
public abstract String getName();
@Property("name")
public abstract void setName(String name);
}
@Test
public void testCreation() {
Set<Class<?>> types = new HashSet<>(Arrays.asList(new Class<?>[]{Employee.class}));
Graph g = TinkerGraph.open();
//implies annotated mode
FramedGraph fg = new DelegatingFramedGraph(g, true, types);
Employee e1 = fg.addFramedVertex(Employee.class);
e1.setName("Jeff");
}
} Both examples above work. I am going to close this issue since it doesnt represent a bug or feature request. However please feel free to continue to comment on it or make any suggestions. I will continue to monitor this issue and respond. |
I just followed your documentation and replaced extends by implements because it didn't compile
|
Where in the documentation did you find that? I will update it. |
@wsalembi Thank you I just fixed this in the readme. Please let me know if you have any problems with any of the other documentation. |
A basic vertex creation in Ferma 3.0.2 generates a ClassCastException:
This is the test class. The cause is not the inner class because it doesn't work as seperate class either.
The text was updated successfully, but these errors were encountered: