View Javadoc

1   package org.apache.maven.changelog;
2   
3   /* ====================================================================
4    *   Licensed to the Apache Software Foundation (ASF) under one or more
5    *   contributor license agreements.  See the NOTICE file distributed with
6    *   this work for additional information regarding copyright ownership.
7    *   The ASF licenses this file to You under the Apache License, Version 2.0
8    *   (the "License"); you may not use this file except in compliance with
9    *   the License.  You may obtain a copy of the License at
10   *
11   *       http://www.apache.org/licenses/LICENSE-2.0
12   *
13   *   Unless required by applicable law or agreed to in writing, software
14   *   distributed under the License is distributed on an "AS IS" BASIS,
15   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   *   See the License for the specific language governing permissions and
17   *   limitations under the License.
18   * ====================================================================
19   */
20  
21  /**
22   * A set of information about revisions of a file as returned by CVS's log
23   * command
24   * @task remove previous revision along with parser changes
25   * @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
26   * @version $Id: ChangeLogFile.java 532339 2007-04-25 12:28:56Z ltheussl $
27   */
28  public class ChangeLogFile
29  {
30      /** the name of the file relative to the project directory. */
31      private String name;
32  
33      /** the latest revision of the file. */
34      private String revision;
35  
36      /**
37       * Constructor for the ChangeLogFile object without all details available
38       * @param name file name
39       */
40      public ChangeLogFile( String name )
41      {
42          setName( name );
43      }
44  
45      /**
46       * Constructor for the ChangeLogFile object
47       *
48       * @param name file name
49       * @param rev latest revision of the file
50       */
51      public ChangeLogFile( String name, String rev )
52      {
53          setName( name );
54          setRevision( rev );
55      }
56  
57      /**
58       * Gets the name attribute of the ChangeLogFile object.
59       * @return the file name
60       */
61      public String getName()
62      {
63          return name;
64      }
65  
66      /**
67       * Gets the revision attribute of the ChangeLogFile object.
68       * @return the latest revision of the file
69       */
70      public String getRevision()
71      {
72          return revision;
73      }
74  
75      /**
76       * Setter for property name.
77       * @param name New value of property name.
78       */
79      public void setName( String name )
80      {
81          this.name = name;
82      }
83  
84      /**
85       * Setter for property revision.
86       * @param revision New value of property revision.
87       */
88      public void setRevision( String revision )
89      {
90          this.revision = revision;
91      }
92  
93      /**
94       * Provide a version of the object as a string for debugging purposes
95       * @return a {@link String} made up of the properties of the object
96       */
97      public String toString()
98      {
99          StringBuffer buffer = new StringBuffer( getName() );
100 
101         if ( getRevision() != null )
102         {
103             buffer.append( ", " ).append( getRevision() );
104         }
105 
106         return buffer.toString();
107     }
108 }
109  // end of ChangeLogFile