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

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

The 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 Node} that always evaluates to the same {@link Value}.
 */
public class ConstNode implements Node {

    private final Value value;

    public ConstNode(Value value) {
        Preconditions.checkArgument(value != null, "null value");
        this.value = value;
    }

    @Override
    public Value evaluate(ParseSession session) {
        return this.value;
    }

    @Override
    public Class getType(ParseSession session) {
        return this.value.getType(session);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy