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

me.ruebner.jvisualizer.backend.vm.values.IntegerValue Maven / Gradle / Ivy

Go to download

This project aims to provide an easy tool to visualize data flow and objects within the JVM. It is intended for students that are starting to learn programming with Java.

The newest version!
package me.ruebner.jvisualizer.backend.vm.values;

import com.fasterxml.jackson.annotation.JsonProperty;
import me.ruebner.jvisualizer.backend.vm.types.IntegerType;

/**
 * Represents a primitive integer value.
 */
public class IntegerValue extends PrimitiveValue {

    /**
     * the actual integer value
     */
    private final int value;

    /**
     * Creates a new integer value object. To create a new integer value object based on a
     * {@link com.sun.jdi.IntegerValue} object, use {@link #fromJdi(com.sun.jdi.IntegerValue)}.
     *
     * @param value the actual integer value
     */
    public IntegerValue(int value) {
        super(IntegerType.create());
        this.value = value;
    }

    /**
     * Creates a new integer value object based on a {@link com.sun.jdi.IntegerValue} object.
     *
     * @param jdiIntegerValue the JDI integer value object
     * @return a new integer value object based on {@code jdiIntegerValue}
     */
    public static IntegerValue fromJdi(com.sun.jdi.IntegerValue jdiIntegerValue) {
        return new IntegerValue(jdiIntegerValue.value());
    }
    
    /**
     * Retrieves the actual integer value.
     *
     * @return the actual integer value
     */
    @JsonProperty
    public int getValue() {
        return value;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy