summaryrefslogtreecommitdiff
path: root/src/com/google/wireless/gdata/calendar/data/When.java
blob: 4f9ab9e9d0cec39b5ca6599855d5b56c6a08489c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2007 The Android Open Source Project
package com.google.wireless.gdata.calendar.data;

import com.google.wireless.gdata.data.StringUtils;

/**
 * Contains information about the start and end of an instance of an event.
 */
public class When {
    private final String startTime;
    private final String endTime;

    /**
     * Creates a new When.
     * @param startTime The start of the event.
     * @param endTime The end of the event.
     */
    public When(String startTime, String endTime) {
        this.startTime = startTime;
        this.endTime = endTime;
    }

    /**
     * Returns the start time for the event.
     * @return The start time for the event.
     */
    public String getStartTime() {
        return startTime;
    }

    /**
     * Returns the end time for the event.
     * @return The end time for the event.
     */
    public String getEndTime() {
        return endTime;
    }

    public void toString(StringBuffer sb) {
        if (!StringUtils.isEmpty(startTime)) {
            sb.append("START TIME: " + startTime + "\n");
        }
        if (!StringUtils.isEmpty(endTime)) {
            sb.append("END TIME: " + endTime + "\n");
        }
    }

    public String toString() {
        StringBuffer sb = new StringBuffer();
        toString(sb);
        return sb.toString();
    }
}