X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FLinkPart.java;h=bbcaf8b7c479913f711b2801069689159c347f6b;hp=202b9db96c31ca862a3f4701391782973cd63b6b;hb=4273a6ebdde8c4f1092a6c5d4f62ad483f3eaa96;hpb=3ab8b115466818f44ac5e35870cec3a4287b9281 diff --git a/src/main/java/net/pterodactylus/sone/text/LinkPart.java b/src/main/java/net/pterodactylus/sone/text/LinkPart.java index 202b9db..bbcaf8b 100644 --- a/src/main/java/net/pterodactylus/sone/text/LinkPart.java +++ b/src/main/java/net/pterodactylus/sone/text/LinkPart.java @@ -1,5 +1,5 @@ /* - * Sone - LinkPart.java - Copyright © 2011–2012 David Roden + * Sone - LinkPart.java - Copyright © 2011–2016 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,6 +17,10 @@ package net.pterodactylus.sone.text; +import java.util.Objects; + +import javax.annotation.Nonnull; + /** * {@link Part} implementation that can hold a link. A link contains of three * attributes: the link itself, the text that is shown instead of the link, and @@ -26,75 +30,32 @@ package net.pterodactylus.sone.text; */ public class LinkPart implements Part { - /** The link of this part. */ private final String link; - - /** The text of this part. */ private final String text; - - /** The title of this part. */ private final String title; - /** - * Creates a new link part. - * - * @param link - * The link of the link part - * @param text - * The text of the link part - */ - public LinkPart(String link, String text) { - this(link, text, text); + public LinkPart(@Nonnull String link, @Nonnull String text) { + this(link, text, link); } - /** - * Creates a new link part. - * - * @param link - * The link of the link part - * @param text - * The text of the link part - * @param title - * The title of the link part - */ - public LinkPart(String link, String text, String title) { - this.link = link; - this.text = text; - this.title = title; + public LinkPart(@Nonnull String link, @Nonnull String text, @Nonnull String title) { + this.link = Objects.requireNonNull(link); + this.text = Objects.requireNonNull(text); + this.title = Objects.requireNonNull(title); } - // - // ACCESSORS - // - - /** - * Returns the link of this part. - * - * @return The link of this part - */ + @Nonnull public String getLink() { return link; } - /** - * Returns the title of this part. - * - * @return The title of this part - */ + @Nonnull public String getTitle() { return title; } - // - // PART METHODS - // - - /** - * Returns the text of this part. - * - * @return The text of this part - */ @Override + @Nonnull public String getText() { return text; }