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.

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.