From 1152e30d55c3842b2fec2bd038bb0555df7ee028 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 18 Sep 2020 18:43:19 +0100 Subject: [PATCH] Merge FontFaceImpl into FontFace and make it a class --- .../java/net/kemitix/fontface/FontFace.java | 49 +++++++++++-------- .../net/kemitix/fontface/FontFaceImpl.java | 30 ------------ 2 files changed, 28 insertions(+), 51 deletions(-) delete mode 100644 src/main/java/net/kemitix/fontface/FontFaceImpl.java diff --git a/src/main/java/net/kemitix/fontface/FontFace.java b/src/main/java/net/kemitix/fontface/FontFace.java index fe2ec20..8ec17fc 100644 --- a/src/main/java/net/kemitix/fontface/FontFace.java +++ b/src/main/java/net/kemitix/fontface/FontFace.java @@ -1,21 +1,35 @@ package net.kemitix.fontface; +import lombok.*; + import java.net.URI; -public interface FontFace { - static FontFace of( +@Getter +@With +@NoArgsConstructor(access = AccessLevel.PRIVATE) +@AllArgsConstructor(access = AccessLevel.PACKAGE) +public class FontFace { + + private URI fontLocation; + private int size; + private String colour; + private String shadowColour; + private int shadowOffsetX; + private int shadowOffsetY; + + public static FontFace of( URI fontUri, int size, String colour, int shadowOffsetX, int shadowOffsetY ) { - final String shadowColour = FontFaceImpl.shadowColour(colour); - return new FontFaceImpl(fontUri, size, colour, + final String shadowColour = FontFace.shadowColour(colour); + return new FontFace(fontUri, size, colour, shadowColour, shadowOffsetX, shadowOffsetY); } - static FontFace of( + public static FontFace of( URI fontUri, int size, String colour @@ -23,21 +37,14 @@ public interface FontFace { return of(fontUri, size, colour, 0, 0); } - URI getFontLocation(); + static String shadowColour(final String colour) { + switch (colour) { + case "white": + case "yellow": + return "black"; + default: + return "white"; + } + } - int getSize(); - - String getColour(); - - String getShadowColour(); - - int getShadowOffsetX(); - - int getShadowOffsetY(); - - FontFace withSize(int size); - FontFace withColour(String colour); - FontFace withShadowColour(String colour); - FontFace withShadowOffsetX(int offset); - FontFace withShadowOffsetY(int offsetY); } diff --git a/src/main/java/net/kemitix/fontface/FontFaceImpl.java b/src/main/java/net/kemitix/fontface/FontFaceImpl.java deleted file mode 100644 index 8c36e8a..0000000 --- a/src/main/java/net/kemitix/fontface/FontFaceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.kemitix.fontface; - -import lombok.*; - -import java.net.URI; - -@Getter -@With -@NoArgsConstructor(access = AccessLevel.PRIVATE) -@AllArgsConstructor(access = AccessLevel.PACKAGE) -public class FontFaceImpl implements FontFace { - - private URI fontLocation; - private int size; - private String colour; - private String shadowColour; - private int shadowOffsetX; - private int shadowOffsetY; - - static String shadowColour(final String colour) { - switch (colour) { - case "white": - case "yellow": - return "black"; - default: - return "white"; - } - } - -}