View Javadoc

1   /*
2    * Copyright 2008-2010 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package de.smartics.maven.issues;
18  
19  import org.apache.maven.artifact.versioning.ArtifactVersion;
20  
21  /**
22   * Defines implementations of the artifact version to create query URLs for
23   * different issue management systems.
24   *
25   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
26   * @version $Revision:591 $
27   */
28  public interface ArtifactVersionRange
29  {
30    // ********************************* Fields *********************************
31  
32    // --- constants ------------------------------------------------------------
33  
34    // ****************************** Initializer *******************************
35  
36    // ****************************** Inner Classes *****************************
37  
38    // ********************************* Methods ********************************
39  
40    // --- get&set --------------------------------------------------------------
41  
42    /**
43     * Returns the specification defining the range of valid versions.
44     *
45     * @return the specification defining the range of valid versions.
46     */
47    String getVersionSpecification();
48  
49    // --- business -------------------------------------------------------------
50  
51    /**
52     * Checks if the given version is part of the range or not.
53     *
54     * @return <code>true</code> if the version is within the range,
55     *         <code>false</code> otherwise.
56     * @throws NullPointerException if <code>version</code> is <code>null</code>.
57     */
58    boolean containsVersion(ArtifactVersion version) throws NullPointerException;
59  
60    /**
61     * Appends the information of this version range to the buffer.
62     *
63     * @param buffer the buffer that contains the URL to be created. If the buffer
64     *          is not empty and does not end with <code>?</code> or
65     *          <code>&amp;</code>, an <code>&amp;</code> is appended.
66     * @return the information of the version range as query parameters for a
67     *         given issue management server.
68     */
69    StringBuilder appendToUrl(final StringBuilder buffer);
70  
71    // --- object basics --------------------------------------------------------
72  
73    /**
74     * {@inheritDoc}
75     * <p>
76     * Returns the version specification passed to the constructor.
77     * </p>
78     *
79     * @see java.lang.Object#toString()
80     */
81    String toString();
82  }