1 // Copyright (c) 2016, Facebook, Inc. All rights reserved. 2 // This source code is licensed under both the GPLv2 (found in the 3 // COPYING file in the root directory) and Apache 2.0 License 4 // (found in the LICENSE.Apache file in the root directory). 5 6 package org.rocksdb; 7 8 /** 9 * Simple instance reference wrapper. 10 */ 11 public class Holder<T> { 12 private /* @Nullable */ T value; 13 14 /** 15 * Constructs a new Holder with null instance. 16 */ Holder()17 public Holder() { 18 } 19 20 /** 21 * Constructs a new Holder. 22 * 23 * @param value the instance or null 24 */ Holder( final T value)25 public Holder(/* @Nullable */ final T value) { 26 this.value = value; 27 } 28 29 /** 30 * Get the instance reference. 31 * 32 * @return value the instance reference or null 33 */ getValue()34 public /* @Nullable */ T getValue() { 35 return value; 36 } 37 38 /** 39 * Set the instance reference. 40 * 41 * @param value the instance reference or null 42 */ setValue( final T value)43 public void setValue(/* @Nullable */ final T value) { 44 this.value = value; 45 } 46 } 47