Merge FontFaceImpl into FontFace and make it a class

This commit is contained in:
Paul Campbell 2020-09-18 18:43:19 +01:00
parent 9020950d90
commit 1152e30d55
2 changed files with 28 additions and 51 deletions

View file

@ -1,21 +1,35 @@
package net.kemitix.fontface; package net.kemitix.fontface;
import lombok.*;
import java.net.URI; import java.net.URI;
public interface FontFace { @Getter
static FontFace of( @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, URI fontUri,
int size, int size,
String colour, String colour,
int shadowOffsetX, int shadowOffsetX,
int shadowOffsetY int shadowOffsetY
) { ) {
final String shadowColour = FontFaceImpl.shadowColour(colour); final String shadowColour = FontFace.shadowColour(colour);
return new FontFaceImpl(fontUri, size, colour, return new FontFace(fontUri, size, colour,
shadowColour, shadowOffsetX, shadowOffsetY); shadowColour, shadowOffsetX, shadowOffsetY);
} }
static FontFace of( public static FontFace of(
URI fontUri, URI fontUri,
int size, int size,
String colour String colour
@ -23,21 +37,14 @@ public interface FontFace {
return of(fontUri, size, colour, 0, 0); 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);
} }

View file

@ -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";
}
}
}