Path: blob/master/src/java.desktop/share/classes/com/sun/beans/decoder/ValueObjectImpl.java
41171 views
/*1* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package com.sun.beans.decoder;2526/**27* This utility class provides {@code static} method28* to create the object that contains the result of method execution.29*30* @since 1.731*32* @author Sergey A. Malenkov33*/34final class ValueObjectImpl implements ValueObject {35static final ValueObject NULL = new ValueObjectImpl(null);36static final ValueObject VOID = new ValueObjectImpl();3738/**39* Returns the object that describes returning value.40*41* @param value the result of method execution42* @return the object that describes value43*/44static ValueObject create(Object value) {45return (value != null)46? new ValueObjectImpl(value)47: NULL;48}4950private Object value;51private boolean isVoid;5253/**54* Creates the object that describes returning void value.55*/56private ValueObjectImpl() {57this.isVoid = true;58}5960/**61* Creates the object that describes returning non-void value.62*63* @param value the result of method execution64*/65private ValueObjectImpl(Object value) {66this.value = value;67}6869/**70* Returns the result of method execution.71*72* @return the result of method execution73*/74public Object getValue() {75return this.value;76}7778/**79* Returns {@code void} state of this value object.80*81* @return {@code true} if value should be ignored,82* {@code false} otherwise83*/84public boolean isVoid() {85return this.isVoid;86}87}888990