From d5936970a469c70e0095980501710ab233c7a027 Mon Sep 17 00:00:00 2001 From: MRappazzo Date: Tue, 24 May 2011 14:59:57 -0400 Subject: [PATCH] Added RiakObject.getLinks() to protocol buffers client --- src/main/java/com/basho/riak/pbc/RiakObject.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/basho/riak/pbc/RiakObject.java b/src/main/java/com/basho/riak/pbc/RiakObject.java index 94e9237f6..cd331432f 100644 --- a/src/main/java/com/basho/riak/pbc/RiakObject.java +++ b/src/main/java/com/basho/riak/pbc/RiakObject.java @@ -1,12 +1,12 @@ /** - * This file is part of riak-java-pb-client + * This file is part of riak-java-pb-client * * Copyright (c) 2010 by Trifork * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -56,7 +56,7 @@ public class RiakObject { this.charset = str(content.getCharset()); this.contentEncoding = str(content.getContentEncoding()); this.vtag = str(content.getVtag()); - this.links = content.getLinksCount() == 0 + this.links = content.getLinksCount() == 0 ? Collections.synchronizedList(new ArrayList()) : Collections.synchronizedList(RiakLink.decode(content.getLinksList())); @@ -133,7 +133,7 @@ public ByteString getValue(){ } RpbContent buildContent() { - Builder b = + Builder b = RpbContent.newBuilder() .setValue(value); @@ -196,5 +196,9 @@ public void addLink(String tag, String bucket, String key) { public void addLink(ByteString tag, ByteString bucket, ByteString key) { links.add(new RiakLink(bucket, key, tag)); } + + public List getLinks() { + return links != null ? Collections.unmodifiableList(links) : Collections.EMPTY_LIST; + } }