
org.apache.cayenne.exp.parser.ASTEnum Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cayenne Show documentation
Show all versions of cayenne Show documentation
Cayenne Object Persistence Framework
The newest version!
/*****************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* https://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.apache.cayenne.exp.parser;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.exp.Expression;
import org.apache.cayenne.util.Util;
/**
* Scalar node that represents constant enumeration value.
* It resolves actual value at a late stage to be parsable in environment where
* final Enum class is not known, i.e. in Modeler.
*
* @since 4.1
*/
public class ASTEnum extends ASTScalar {
ASTEnum(int id) {
super(id);
}
public ASTEnum() {
super(ExpressionParserTreeConstants.JJTENUM);
}
public ASTEnum(Object value) {
super(ExpressionParserTreeConstants.JJTENUM);
setValue(value);
}
@Override
protected Object evaluateNode(Object o) {
return getValueAsEnum().resolve();
}
@Override
public Expression shallowCopy() {
ASTScalar copy = new ASTEnum(id);
copy.value = value;
return copy;
}
@Override
public void appendAsEJBQL(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy