001/*
002 *  Copyright (c) 2023-2026, Agents-Flex (fuhai999@gmail.com).
003 *  <p>
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *  <p>
008 *  http://www.apache.org/licenses/LICENSE-2.0
009 *  <p>
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package com.agentsflex.core.store.condition;
017
018public class Value implements Operand {
019
020    private Condition condition;
021    private Object value;
022
023    public Value(Object value) {
024        this.value = value;
025    }
026
027    public Value(Object... values){
028        this.value = values;
029    }
030
031    public Object getValue() {
032        return value;
033    }
034
035    public void setValue(Object value) {
036        this.value = value;
037    }
038
039    public Condition getCondition() {
040        return condition;
041    }
042
043    public void setCondition(Condition condition) {
044        this.condition = condition;
045    }
046
047    @Override
048    public String toExpression(ExpressionAdaptor adaptor) {
049        if (value instanceof Operand) {
050            return adaptor.toRight(this);
051        }
052        return adaptor.toValue(condition, value);
053    }
054}