All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jsimpledb.parse.expr.ValueValue Maven / Gradle / Ivy

There is a newer version: 3.6.1
Show newest version

/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.parse.expr;

import com.google.common.base.Preconditions;

import org.jsimpledb.parse.ParseSession;

/**
 * A {@link Value} that holds a reference to some other {@link Value}.
 */
public class ValueValue extends AbstractLValue {

    private Value value;

    /**
     * Constructor.
     *
     * 

* This instance will have no initial value; until one is set, {@link #get get()} will throw an exception. */ public ValueValue() { this(null); } /** * Constructor. * * @param value initial value, or null for none */ public ValueValue(Value value) { this.value = value; } @Override public Object get(ParseSession session) { if (this.value == null) throw new EvalException("value not defined"); return this.value.get(session); } @Override public Class getType(ParseSession session) { return this.value.getType(session); } @Override public void set(ParseSession session, Value value) { Preconditions.checkArgument(value != null, "null value"); this.value = value; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy