Coverage Report - com.jcabi.github.References
 
Classes in this File Line Coverage Branch Coverage Complexity
References
N/A
N/A
1
 
 1  
 /**
 2  
  * Copyright (c) 2013-2015, jcabi.com
 3  
  * All rights reserved.
 4  
  *
 5  
  * Redistribution and use in source and binary forms, with or without
 6  
  * modification, are permitted provided that the following conditions
 7  
  * are met: 1) Redistributions of source code must retain the above
 8  
  * copyright notice, this list of conditions and the following
 9  
  * disclaimer. 2) Redistributions in binary form must reproduce the above
 10  
  * copyright notice, this list of conditions and the following
 11  
  * disclaimer in the documentation and/or other materials provided
 12  
  * with the distribution. 3) Neither the name of the jcabi.com nor
 13  
  * the names of its contributors may be used to endorse or promote
 14  
  * products derived from this software without specific prior written
 15  
  * permission.
 16  
  *
 17  
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18  
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
 19  
  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 20  
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 21  
  * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 22  
  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 23  
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 24  
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 25  
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 26  
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 27  
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 28  
  * OF THE POSSIBILITY OF SUCH DAMAGE.
 29  
  */
 30  
 package com.jcabi.github;
 31  
 
 32  
 import com.jcabi.aspects.Immutable;
 33  
 import java.io.IOException;
 34  
 import javax.validation.constraints.NotNull;
 35  
 
 36  
 /**
 37  
  * Github Git Data References.
 38  
  *
 39  
  * @author Carlos Miranda (miranda.cma@gmail.com)
 40  
  * @version $Id$
 41  
  * @since 0.8
 42  
  * @see <a href="http://developer.github.com/v3/git/references/">References API</a>
 43  
  */
 44  
 @Immutable
 45  
 public interface References {
 46  
 
 47  
     /**
 48  
      * Owner of them.
 49  
      * @return Repo
 50  
      */
 51  
     @NotNull(message = "repository is never null")
 52  
     Repo repo();
 53  
 
 54  
     /**
 55  
      * Creates a reference.
 56  
      * @param ref The name of the fully qualified reference (ie: refs/heads/master).
 57  
      * @param sha The SHA1 value to set this reference to.
 58  
      * @return Reference - The newly created Reference
 59  
      * @throws IOException - If there are any errors.
 60  
      */
 61  
     @NotNull(message = "reference is never null")
 62  
     Reference create(
 63  
         @NotNull(message = "ref can't be NULL") String ref,
 64  
         @NotNull(message = "sha can't be NULL") String sha
 65  
     ) throws IOException;
 66  
 
 67  
     /**
 68  
      * Get Reference by identifier.
 69  
      * @param identifier Reference's name.
 70  
      * @return Reference The reference with the given name
 71  
      */
 72  
     @NotNull(message = "reference is never null")
 73  
     Reference get(
 74  
         @NotNull(message = "identifier can't be null") String identifier
 75  
     );
 76  
 
 77  
     /**
 78  
      * Iterates all references.
 79  
      * @return Iterator of references.
 80  
      */
 81  
     @NotNull(message = "iterable is never NULL")
 82  
     Iterable<Reference> iterate();
 83  
 
 84  
     /**
 85  
      * Iterates references in sub-namespace.
 86  
      * @param subnamespace Sub-namespace
 87  
      * @return Iterator of references.
 88  
      */
 89  
     @NotNull(message = "iterable is never NULL")
 90  
     Iterable<Reference> iterate(
 91  
         @NotNull(message = "identifier can't be null") String subnamespace
 92  
     );
 93  
 
 94  
     /**
 95  
      * Iterate references under "tags" sub-namespace.
 96  
      * @return Iterator of references.
 97  
      */
 98  
     @NotNull(message = "iterable of tags is never NULL")
 99  
     Iterable<Reference> tags();
 100  
 
 101  
     /**
 102  
      * Iterate references under "heads" sub-namespace.
 103  
      * @return Iterator of references.
 104  
      */
 105  
     @NotNull(message = "iterable of heads is never NULL")
 106  
     Iterable<Reference> heads();
 107  
 
 108  
     /**
 109  
      * Removes a reference by its identifier.
 110  
      * @param identifier Reference's identifier.
 111  
      * @throws IOException If there is any I/O problem.
 112  
      */
 113  
     void remove(
 114  
         @NotNull(message = "identifier can't be NULL") String identifier
 115  
     ) throws IOException;
 116  
 }