Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ferma
Ferma
Commits
2d17f476
Unverified
Commit
2d17f476
authored
Jan 16, 2018
by
Jeffrey Phillips Freeman
💥
Committed by
GitHub
Jan 16, 2018
Browse files
Merge pull request #40 from jsight/patch-1
Allow the value to a setter to be null
parents
3fc3931a
480a517d
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
2d17f476
...
...
@@ -3,3 +3,6 @@ target/
.project
.settings
site
.idea/
ferma.iml
src/main/java/com/syncleus/ferma/framefactories/annotation/AdjacencyMethodHandler.java
View file @
2d17f476
...
...
@@ -362,7 +362,7 @@ public class AdjacencyMethodHandler extends AbstractMethodHandler {
default
:
throw
new
IllegalStateException
(
"Direction not recognized."
);
}
}).
next
(
VertexFrame
.
class
);
}).
next
OrDefault
(
VertexFrame
.
class
,
null
);
}
}
...
...
@@ -645,16 +645,20 @@ public class AdjacencyMethodHandler extends AbstractMethodHandler {
switch
(
direction
)
{
case
BOTH:
thiz
.
unlinkBoth
(
null
,
label
);
thiz
.
getGraph
().
addFramedEdge
(
vertexFrame
,
thiz
,
label
);
thiz
.
getGraph
().
addFramedEdge
(
thiz
,
vertexFrame
,
label
);
if
(
vertexFrame
!=
null
)
{
thiz
.
getGraph
().
addFramedEdge
(
vertexFrame
,
thiz
,
label
);
thiz
.
getGraph
().
addFramedEdge
(
thiz
,
vertexFrame
,
label
);
}
break
;
case
IN:
thiz
.
unlinkIn
(
null
,
label
);
thiz
.
getGraph
().
addFramedEdge
(
vertexFrame
,
thiz
,
label
);
if
(
vertexFrame
!=
null
)
thiz
.
getGraph
().
addFramedEdge
(
vertexFrame
,
thiz
,
label
);
break
;
case
OUT:
thiz
.
unlinkOut
(
null
,
label
);
thiz
.
getGraph
().
addFramedEdge
(
thiz
,
vertexFrame
,
label
);
if
(
vertexFrame
!=
null
)
thiz
.
getGraph
().
addFramedEdge
(
thiz
,
vertexFrame
,
label
);
break
;
default
:
throw
new
IllegalStateException
(
method
.
getName
()
+
" is annotated with a direction other than BOTH, IN, or OUT."
);
...
...
src/test/java/com/syncleus/ferma/annotations/AdjacencyMethodHandlerTest.java
View file @
2d17f476
...
...
@@ -323,6 +323,26 @@ public class AdjacencyMethodHandlerTest {
Assert
.
assertTrue
(
child
instanceof
GodExtended
);
}
@Test
public
void
testSetSonNull
()
{
GodGraphLoader
.
load
(
godGraph
);
final
FramedGraph
framedGraph
=
new
DelegatingFramedGraph
(
godGraph
,
TEST_TYPES
);
final
List
<?
extends
God
>
gods
=
framedGraph
.
traverse
(
input
->
input
.
V
().
has
(
"name"
,
"jupiter"
)).
toList
(
God
.
class
);
final
God
father
=
gods
.
iterator
().
next
();
Assert
.
assertTrue
(
father
!=
null
);
final
VertexFrame
fatherVertex
=
father
;
Assert
.
assertEquals
(
fatherVertex
.
getProperty
(
"name"
),
"jupiter"
);
father
.
setSon
(
null
);
final
God
sonNull
=
father
.
getSon
();
Assert
.
assertNull
(
sonNull
);
}
@Test
public
void
testAddSonDefault
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment