![JAR search and dependency download from the Maven repository](/logo.png)
org.snapscript.tree.collection.ArrayValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.tree.collection;
import org.snapscript.core.variable.Value;
import java.lang.reflect.Array;
public class ArrayValue extends Value {
private final Object array;
private final Integer index;
private final Class type;
public ArrayValue(Object array, Integer index) {
this.type = array.getClass();
this.array = array;
this.index = index;
}
@Override
public Class getType() {
return type.getComponentType();
}
@Override
public Object getValue(){
return Array.get(array, index);
}
@Override
public void setValue(Object value){
Array.set(array, index, value);
}
@Override
public String toString() {
return String.valueOf(array);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy