April 2004
Intermediate to advanced
606 pages
20h 4m
English
Example 5-2 shows part of
the
com.mycompany.expense.Report class.
package com.mycompany.expense; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; public class Report implements Serializable { public static final int STATUS_NEW = 0; public static final int STATUS_OPEN = 1; public static final int STATUS_SUBMITTED = 2; public static final int STATUS_ACCEPTED = 3; public static final int STATUS_REJECTED = 4; private int currentEntryId; private int id = -1; private String title; private String owner; private int status = STATUS_NEW; private Map entries; public Report( ) { entries = new HashMap( ); } public Report(Report src) { setId(src.getId( )); setTitle(src.getTitle( )); setOwner(src.getOwner( )); setStatus(src.getStatus( )); setEntries(src.copyEntries( )); setCurrentEntryId(src.getCurrentEntryId( )); } public synchronized int getId( ) { return id; } public synchronized void setId(int id) { this.id = id; } public synchronized String getTitle( ) { return title; } public synchronized void setTitle(String title) { this.title = title; } public synchronized String getOwner( ) { return owner; } public synchronized void setOwner(String owner) { this.owner = owner; } public synchronized int getStatus( ) { return status; } public ...Read now
Unlock full access