Skip to content

#000 Requirements

Valkryst edited this page Jul 26, 2018 · 6 revisions

This tutorial has been written using both Java and the VTerminal library. This allows for cross-platform support, thanks to Java and the JVM, as well as simplified rendering with the use of VTerminal.

Before we begin, it is assumed that you have a working knowledge of Java and an appropriate environment (JRE, JDK, and your choice of IDE) prepared for development. You will also need to create a new project within your IDE, set it up to use Maven, and add VTerminal as a dependency as per the instructions on the project page.

If you have any comments, questions, or suggestions, then feel free to join the VTerminal Discord channel and contact me directly.

Lombok

While writing the code, I will be using the Lombok library as a Maven dependency. This library allows me to quickly write getters and setters for my class' variables by using the @Data, @Getter, @Setter, and @NonNull annotations.

The following code examples are equivalent.

@Data
public class Example {
    private int valA;
    private int valB;
}
public class Example {
    @Getter @Setter private int valA;
    @Getter @Setter private int valB
}
public class Example {
    private int valA;
    private int valB;

    public void setValA(int newValA) {
        this.valA = valA;
    }

    public int getValA() {
        return valA;
    }

    public void setValB(int newValB) {
        this.valB = valB;
    }

    public int getValB() {
        return valB;
    }
}

The following code examples are also equivalent:

public class Example {
    private Integer val;

    public Example(final @NonNull Integer val) {
        this.val = val;
    }
}
public class Example {
    private Integer val;

    public Example(final Integer val) {
        Objects.requireNonNull(val);

        this.val = val;
    }
}
public class Example {
    private Integer val;

    public Example(final Integer val) {
        if (val == null) {
            throw new NullPointerException("The parameter 'val' cannot be null.");
        }

        this.val = val;
    }
}

Useful Resources

Clone this wiki locally