Skip to content

Commit

Permalink
Merge pull request #1397 from datafaker-net/refactor/add-missing-over…
Browse files Browse the repository at this point in the history
…ride-annotations

add missing @OverRide annotations
  • Loading branch information
kingthorin authored Oct 21, 2024
2 parents 17084c5 + 848dfe7 commit 24f2e7a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/main/java/net/datafaker/providers/base/BaseFaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public BaseFaker(FakeValuesService fakeValuesService, FakerContext context) {
fakeValuesService.updateFakeValuesInterfaceMap(context.getLocaleChain());
}

@Override
public FakerContext getContext() {
return context;
}
Expand Down Expand Up @@ -126,6 +127,7 @@ public <T> T doWith(Callable<T> callable, Locale locale, long seed) {
* @param numberString Template for string generation
* @return Generated string
*/
@Override
public String numerify(String numberString) {
return fakeValuesService.numerify(numberString, context);
}
Expand All @@ -139,6 +141,7 @@ public String numerify(String numberString) {
* @param letterString Template for string generation
* @return Generated string.
*/
@Override
public String letterify(String letterString) {
return fakeValuesService.letterify(letterString, context);
}
Expand All @@ -149,6 +152,7 @@ public String letterify(String letterString) {
* <p>
* For example, the string "12??34" could be replaced with a string like "12AB34".
*/
@Override
public String letterify(String letterString, boolean isUpper) {
return fakeValuesService.letterify(letterString, context, isUpper);
}
Expand All @@ -157,6 +161,7 @@ public String letterify(String letterString, boolean isUpper) {
* Applies both a {@link #numerify(String)} and a {@link #letterify(String)}
* over the incoming string.
*/
@Override
public String bothify(String string) {
return fakeValuesService.bothify(string, context);
}
Expand All @@ -165,13 +170,15 @@ public String bothify(String string) {
* Applies both a {@link #numerify(String)} and a {@link #letterify(String)}
* over the incoming string.
*/
@Override
public String bothify(String string, boolean isUpper) {
return fakeValuesService.bothify(string, context, isUpper);
}

/**
* Generates a String that matches the given regular expression.
*/
@Override
public String regexify(String regex) {
return fakeValuesService.regexify(regex, context);
}
Expand All @@ -188,6 +195,7 @@ public String regexify(String regex) {
* @param example The input string
* @return The output string based on the input pattern
*/
@Override
public String examplify(String example) {
return fakeValuesService.examplify(example, context);
}
Expand All @@ -203,6 +211,7 @@ public String examplify(String example) {
* @param options Options to use while filling the template
* @return Generated string
*/
@Override
public String templatify(String string, char char2replace, String... options) {
return fakeValuesService().templatify(string, char2replace, context, options);
}
Expand All @@ -218,6 +227,7 @@ public String templatify(String string, char char2replace, String... options) {
* @param optionsMap Map with replacement rules
* @return Generated string
*/
@Override
public String templatify(String string, Map<Character, String[]> optionsMap) {
return fakeValuesService().templatify(string, optionsMap, context);
}
Expand All @@ -238,6 +248,7 @@ public String templatify(String string, Map<Character, String[]> optionsMap) {
* The odd numbers args are used for columns names, and even for column values.
* @return Generated string
*/
@Override
public String csv(int limit, String... columnExpressions) {
return fakeValuesService().csv(limit, columnExpressions);
}
Expand All @@ -261,22 +272,27 @@ public String csv(int limit, String... columnExpressions) {
* The odd numbers args are used for columns names, and even for column values.
* @return Generated string
*/
@Override
public String csv(String separator, char quote, boolean withHeader, int limit, String... columnExpressions) {
return fakeValuesService().csv(separator, quote, withHeader, limit, columnExpressions);
}

@Override
public String json(String... fieldExpressions) {
return fakeValuesService().json(fieldExpressions);
}

@Override
public String jsona(String... fieldExpressions) {
return fakeValuesService().jsona(fieldExpressions);
}

@Override
public RandomService random() {
return this.context.getRandomService();
}

@Override
public FakeValuesService fakeValuesService() {
return this.fakeValuesService;
}
Expand All @@ -288,6 +304,7 @@ public FakeValuesService fakeValuesService() {
* @param path path to a file with YAML structure
* @throws IllegalArgumentException in case of invalid path
*/
@Override
public void addPath(Locale locale, Path path) {
fakeValuesService().addPath(locale, path);
}
Expand All @@ -299,7 +316,7 @@ public void addPath(Locale locale, Path path) {
* @param url url of a file with YAML structure
* @throws IllegalArgumentException in case of invalid url
*/

@Override
public void addUrl(Locale locale, URL url) {
fakeValuesService().addUrl(locale, url);
}
Expand Down Expand Up @@ -362,10 +379,12 @@ public final <T> FakeSequence.Builder<T> stream(List<Supplier<T>> suppliers) {
return new FakeStream.Builder<>(suppliers).faker(this);
}

@Override
public String resolve(String key) {
return this.fakeValuesService.resolve(key, this, this, context);
}

@Override
public String resolve(String key, Supplier<String> message) {
return this.fakeValuesService.resolve(key, this, this, message, context);
}
Expand All @@ -387,6 +406,7 @@ public String resolve(String key, Supplier<String> message) {
* @return the evaluated string expression
* @throws RuntimeException if unable to evaluate the expression
*/
@Override
public String expression(String expression) {
return this.fakeValuesService.expression(expression, this, getContext());
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/datafaker/sequence/FakeCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ private FakeCollection(List<Supplier<T>> suppliers, int minLength, int maxLength
super(suppliers, minLength, maxLength, randomService, nullRate);
}

@Override
@SuppressWarnings("unchecked")
public List<T> get() {
int size = randomService.nextInt(minLength, maxLength);
Expand Down Expand Up @@ -43,6 +44,7 @@ public Builder(Supplier<T>... elems) {
super(elems);
}

@Override
public FakeCollection<T> build() {
if (maxLength < 0) {
maxLen(FAKE_COLLECTION_DEFAULT_SIZE);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/datafaker/sequence/FakeStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ private FakeStream(List<Supplier<T>> suppliers, int minLength, int maxLength, Ra
super(suppliers, minLength, maxLength, randomService, nullRate);
}

@Override
@SuppressWarnings("unchecked")
public Stream<T> get() {
if (isInfinite()) {
Expand All @@ -22,6 +23,7 @@ public Stream<T> get() {
return Stream.generate(this::singleton).limit(size);
}

@Override
public boolean isInfinite() {
return maxLength < 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public String getEndStream() {
return "]";
}

@Override
public String getElementSeparator() {
return ",";
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/net/datafaker/AbstractFakerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.datafaker.providers.base.BaseFakerTest;

public class AbstractFakerTest extends BaseFakerTest<Faker> {
@Override
protected Faker getFaker() {
return new Faker();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final void before() {
food = getFaker().food();
}

@Override
protected FoodFaker getFaker() {
return new FoodFaker(new Locale("he"));
}
Expand Down

0 comments on commit 24f2e7a

Please sign in to comment.