From 9272f89ce3d59d91b258282aaaea16b33aaf8a32 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sat, 17 Jul 2010 18:18:23 +0000 Subject: [PATCH] --- .../java/org/wamblee/general/ValueHolder.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 support/general/src/main/java/org/wamblee/general/ValueHolder.java diff --git a/support/general/src/main/java/org/wamblee/general/ValueHolder.java b/support/general/src/main/java/org/wamblee/general/ValueHolder.java new file mode 100644 index 00000000..1ec74feb --- /dev/null +++ b/support/general/src/main/java/org/wamblee/general/ValueHolder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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 + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wamblee.general; + +/** + * Object that holds a value of some type. This can be used where a mutable final value would + * be preferred. + * + * @author Erik Brakkee + * + */ +public class ValueHolder { + + private T value; + + /** + * Constructs with null value. + */ + public ValueHolder() { + value = null; + } + + /** + * Constructs with given value. + * @param aValue Value. + */ + public ValueHolder(T aValue) { + value = aValue; + } + + /** + * @return Current value. + */ + public T getValue() { + return value; + } + + /** + * Set the value. + * @param aValue New value. + */ + public void setValue(T aValue) { + value = aValue; + } +} -- 2.31.1