Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2013 the original author or authors.
  *
  * Licensed 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
  *
  *      http://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.springframework.data.mongodb.core.spel;
import  org.springframework.expression.spel.ExpressionState;
import  org.springframework.expression.spel.ast.FloatLiteral;
import  org.springframework.expression.spel.ast.IntLiteral;
import  org.springframework.expression.spel.ast.Literal;
import  org.springframework.expression.spel.ast.LongLiteral;
import  org.springframework.expression.spel.ast.NullLiteral;
import  org.springframework.expression.spel.ast.RealLiteral;
import  org.springframework.expression.spel.ast.StringLiteral;

A node representing a literal in an expression.

Author(s):
Oliver Gierke
public class LiteralNode extends ExpressionNode {
	private final Literal literal;

Creates a new LiteralNode from the given Literal and ExpressionState.

Parameters:
node must not be null.
state must not be null.
	LiteralNode(Literal node, ExpressionState state) {
		super(nodestate);
		this. = node;
	}

Returns whether the given ExpressionNode is a unary minus.

Parameters:
parent
Returns:
	public boolean isUnaryMinus(ExpressionNode parent) {
		if (!(parent instanceof OperatorNode)) {
			return false;
		}
		OperatorNode operator = (OperatorNodeparent;
		return operator.isUnaryMinus() && operator.getRight() == null;
	}
	/*
	 * (non-Javadoc)
	 * @see org.springframework.data.mongodb.core.spel.ExpressionNode#isLiteral()
	 */
	public boolean isLiteral() {
		return  instanceof FloatLiteral ||  instanceof RealLiteral ||  instanceof IntLiteral
				||  instanceof LongLiteral ||  instanceof StringLiteral ||  instanceof NullLiteral;
	}
New to GrepCode? Check out our FAQ X