7. The DateManipulator Mutable Companion to Date.

Listing 7. The DateManipulator Mutable Companion to Date.


public class DateManipulator ...
{
    public synchronized void set(
        Year year, Month month, int day)
    {
        this.year = year;
        this.month = month;
        this.day = day;
    }
    public synchronized Date toDate()
        { return new Date(year, month, day); }
    public int getYear() { return year.getValue(); }
    ...
    private Year year;
    private Month month;
    private int day;
}

About the Author

Kevlin Henney is a Principal Technologist with QA Training in the UK.

Upcoming Training Events

0 AM
Visual Studio Live! San Diego
September 8-12, 2025
Live! 360 Orlando
November 16-21, 2025
Cloud & Containers Live! Orlando
November 16-21, 2025
Data Platform Live! Orlando
November 16-21, 2025
Visual Studio Live! Orlando
November 16-21, 2025