commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ans...@apache.org
Subject [3/4] incubator-commonsrdf git commit: Avoid storing Optional objects, per their lack of serialisability
Date Sat, 28 Mar 2015 05:02:26 GMT
Avoid storing Optional objects, per their lack of serialisability

This will enable a smooth change in the future if we decide the simple
module should be serialisable, which is unlikely, but best not to
promote the use of Optional fields per this reason.

Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/6ba4c76b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/6ba4c76b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/6ba4c76b

Branch: refs/heads/master
Commit: 6ba4c76b85304f81553a7dc3de71cb6210d2df4b
Parents: 2b72b84
Author: Peter Ansell <p_ansell@yahoo.com>
Authored: Sat Mar 28 15:55:29 2015 +1100
Committer: Peter Ansell <p_ansell@yahoo.com>
Committed: Sat Mar 28 15:55:29 2015 +1100

----------------------------------------------------------------------
 .../main/java/org/apache/commons/rdf/simple/BlankNodeImpl.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6ba4c76b/simple/src/main/java/org/apache/commons/rdf/simple/BlankNodeImpl.java
----------------------------------------------------------------------
diff --git a/simple/src/main/java/org/apache/commons/rdf/simple/BlankNodeImpl.java b/simple/src/main/java/org/apache/commons/rdf/simple/BlankNodeImpl.java
index 46cb32f..398ad37 100644
--- a/simple/src/main/java/org/apache/commons/rdf/simple/BlankNodeImpl.java
+++ b/simple/src/main/java/org/apache/commons/rdf/simple/BlankNodeImpl.java
@@ -30,18 +30,18 @@ import org.apache.commons.rdf.api.Graph;
  * A simple implementation of BlankNode.
  *
  */
-class BlankNodeImpl implements BlankNode {
+final class BlankNodeImpl implements BlankNode {
 
 	private static AtomicLong bnodeCounter = new AtomicLong();
 	private final String id;
-	private final Optional<Graph> localScope;
+	private final Graph localScope;
 
 	public BlankNodeImpl() {
 		this(Optional.empty(), "b:" + bnodeCounter.incrementAndGet());
 	}
 
 	public BlankNodeImpl(Optional<Graph> localScope, String id) {
-		this.localScope = Objects.requireNonNull(localScope);
+		this.localScope = Objects.requireNonNull(localScope).orElse(null);
 		if (Objects.requireNonNull(id).isEmpty()) {
 			throw new IllegalArgumentException("Invalid blank node id: " + id);
 			// NOTE: It is valid for the id to not be a valid ntriples bnode id.


Mime
View raw message