All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kohsuke.github.GHLabelBuilder Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha-2
Show newest version
package org.kohsuke.github;

import java.io.IOException;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

// TODO: Auto-generated Javadoc
/**
 * The Class GHLabelBuilder.
 *
 * @param 
 *            Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S}
 *            the same as {@link GHLabel}, this builder will commit changes after each call to
 *            {@link #with(String, Object)}.
 */
class GHLabelBuilder extends AbstractBuilder {

    /**
     * Instantiates a new GH label builder.
     *
     * @param intermediateReturnType
     *            Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If
     *            {@link S} the same as {@link GHLabel}, this builder will commit changes after each call to
     *            {@link #with(String, Object)}.
     * @param root
     *            the GitHub instance to which updates will be sent
     * @param baseInstance
     *            instance on which to base this builder. If {@code null} a new instance will be created.
     */
    protected GHLabelBuilder(@Nonnull Class intermediateReturnType,
            @Nonnull GitHub root,
            @CheckForNull GHLabel baseInstance) {
        super(GHLabel.class, intermediateReturnType, root, baseInstance);

        if (baseInstance != null) {
            requester.with("name", baseInstance.getName());
            requester.with("color", baseInstance.getColor());
            requester.with("description", baseInstance.getDescription());
        }
    }

    /**
     * Name.
     *
     * @param value
     *            the value
     * @return the s
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    @Nonnull
    @BetaApi
    public S name(String value) throws IOException {
        return with("name", value);
    }

    /**
     * Color.
     *
     * @param value
     *            the value
     * @return the s
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    @Nonnull
    @BetaApi
    public S color(String value) throws IOException {
        return with("color", value);
    }

    /**
     * Description.
     *
     * @param value
     *            the value
     * @return the s
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    @Nonnull
    @BetaApi
    public S description(String value) throws IOException {
        return with("description", value);
    }
}