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

io.pebbletemplates.pebble.node.expression.LiteralDoubleExpression Maven / Gradle / Ivy

There is a newer version: 3.2.3
Show newest version
/*
 * This file is part of Pebble.
 *
 * Copyright (c) 2014 by Mitchell Bösecke
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
package io.pebbletemplates.pebble.node.expression;

import io.pebbletemplates.pebble.extension.NodeVisitor;
import io.pebbletemplates.pebble.template.EvaluationContextImpl;
import io.pebbletemplates.pebble.template.PebbleTemplateImpl;

public class LiteralDoubleExpression implements Expression {

  private final Double value;

  private final int lineNumber;

  public LiteralDoubleExpression(Double value, int lineNumber) {
    this.value = value;
    this.lineNumber = lineNumber;
  }

  @Override
  public void accept(NodeVisitor visitor) {
    visitor.visit(this);
  }

  @Override
  public Double evaluate(PebbleTemplateImpl self, EvaluationContextImpl context) {
    return this.value;
  }

  @Override
  public int getLineNumber() {
    return this.lineNumber;
  }

  @Override
  public String toString() {
    return this.value.toString();
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy