View Javadoc

1   /*
2    * Copyright 2008-2013 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  package de.smartics.maven.issues;
17  
18  import org.apache.maven.artifact.versioning.ArtifactVersion;
19  
20  /**
21   * Defines implementations of the artifact version to create query URLs for
22   * different issue management systems.
23   *
24   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
25   * @version $Revision:591 $
26   */
27  public interface ArtifactVersionRange
28  {
29    // ********************************* Fields *********************************
30  
31    // --- constants ------------------------------------------------------------
32  
33    // ****************************** Initializer *******************************
34  
35    // ****************************** Inner Classes *****************************
36  
37    // ********************************* Methods ********************************
38  
39    // --- get&set --------------------------------------------------------------
40  
41    /**
42     * Returns the specification defining the range of valid versions.
43     *
44     * @return the specification defining the range of valid versions.
45     */
46    String getVersionSpecification();
47  
48    // --- business -------------------------------------------------------------
49  
50    /**
51     * Checks if the given version is part of the range or not.
52     *
53     * @return <code>true</code> if the version is within the range,
54     *         <code>false</code> otherwise.
55     * @throws NullPointerException if <code>version</code> is <code>null</code>.
56     */
57    boolean containsVersion(ArtifactVersion version) throws NullPointerException;
58  
59    /**
60     * Appends the information of this version range to the buffer.
61     *
62     * @param buffer the buffer that contains the URL to be created. If the buffer
63     *          is not empty and does not end with <code>?</code> or
64     *          <code>&amp;</code>, an <code>&amp;</code> is appended.
65     * @return the information of the version range as query parameters for a
66     *         given issue management server.
67     */
68    StringBuilder appendToUrl(final StringBuilder buffer);
69  
70    // --- object basics --------------------------------------------------------
71  
72    /**
73     * {@inheritDoc}
74     * <p>
75     * Returns the version specification passed to the constructor.
76     * </p>
77     *
78     * @see java.lang.Object#toString()
79     */
80    String toString();
81  }