X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSonePart.java;h=576eb7b3afc41966d50f620f4868e517f604817c;hp=5c6a63d673d488f966fb529dbaf7997024d3b456;hb=7b55e0be6a3283e43a9bbab98f82aebdd948eb33;hpb=a170ca4a7b77749951028f691ab126cd507a96fa diff --git a/src/main/java/net/pterodactylus/sone/text/SonePart.java b/src/main/java/net/pterodactylus/sone/text/SonePart.java index 5c6a63d..576eb7b 100644 --- a/src/main/java/net/pterodactylus/sone/text/SonePart.java +++ b/src/main/java/net/pterodactylus/sone/text/SonePart.java @@ -1,5 +1,5 @@ /* - * Sone - SoneLinkPart.java - Copyright © 2011 David Roden + * Sone - SonePart.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,7 +17,12 @@ package net.pterodactylus.sone.text; +import java.util.Objects; + +import javax.annotation.Nonnull; + import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.template.SoneAccessor; /** * {@link Part} implementation that stores a reference to a {@link Sone}. @@ -26,30 +31,20 @@ import net.pterodactylus.sone.data.Sone; */ public class SonePart implements Part { - /** The referenced {@link Sone}. */ private final Sone sone; - /** - * Creates a new Sone part. - * - * @param sone - * The referenced Sone - */ - public SonePart(Sone sone) { - this.sone = sone; + public SonePart(@Nonnull Sone sone) { + this.sone = Objects.requireNonNull(sone); } - // - // ACCESSORS - // - - /** - * Returns the referenced Sone. - * - * @return The referenced Sone - */ + @Nonnull public Sone getSone() { return sone; } + @Override + public String getText() { + return SoneAccessor.getNiceName(sone); + } + }