View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.scm.command.blame;
20  
21  import java.io.Serializable;
22  import java.util.Date;
23  
24  /**
25   * @author Evgeny Mandrikov
26   * @since 1.4
27   */
28  public class BlameLine implements Serializable {
29  
30      private static final long serialVersionUID = 2675122069344705612L;
31  
32      private Date date;
33  
34      private String revision;
35  
36      private String author;
37  
38      private String committer;
39  
40      /**
41       * @param date of the commit
42       * @param revision of the commit
43       * @param author will also be used as committer identification
44       */
45      public BlameLine(Date date, String revision, String author) {
46          this(date, revision, author, author);
47      }
48  
49      /**
50       *
51       * @param date of the commit
52       * @param revision of the commit
53       * @param author the person who wrote the line
54       * @param committer the person who committed the change
55       */
56      public BlameLine(Date date, String revision, String author, String committer) {
57          setDate(date);
58          setRevision(revision);
59          setAuthor(author);
60          setCommitter(committer);
61      }
62  
63      public String getRevision() {
64          return revision;
65      }
66  
67      public void setRevision(String revision) {
68          this.revision = revision;
69      }
70  
71      public String getAuthor() {
72          return author;
73      }
74  
75      public void setAuthor(String author) {
76          this.author = author;
77      }
78  
79      public String getCommitter() {
80          return committer;
81      }
82  
83      public void setCommitter(String committer) {
84          this.committer = committer;
85      }
86  
87      /**
88       * @return the commit date
89       */
90      public Date getDate() {
91          if (date != null) {
92              return (Date) date.clone();
93          }
94          return null;
95      }
96  
97      public void setDate(Date date) {
98          if (date != null) {
99              this.date = new Date(date.getTime());
100         } else {
101             this.date = null;
102         }
103     }
104 }