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

org.snapscript.core.Constant Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.core;

public class Constant extends Value {
   
   private final Object value;
   private final Type type;
   
   public Constant(Object value) {
      this(value, null);
   }

   public Constant(Object value, Type type) {
      this.value = value;
      this.type = type;
   }
   
   @Override
   public Type getConstraint() {
      return type;
   }
   
   @Override
   public  T getValue() {
      return (T)value;
   }
   
   @Override
   public void setValue(Object value){
      throw new InternalStateException("Illegal modification of constant");
   } 
   
   @Override
   public String toString() {
      return String.valueOf(value);
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy