feat:优化api

This commit is contained in:
wangyu 2022-01-06 23:48:37 +08:00
parent 04b2152ab7
commit 28284cddec
2 changed files with 27 additions and 11 deletions

View File

@ -2,7 +2,6 @@ package com.flyfish.framework.config;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -11,9 +10,8 @@ import java.util.function.Supplier;
* *
* @author wangyu * @author wangyu
*/ */
@Setter
@Getter @Getter
@Accessors(chain = true) @Setter
public class FrameworkConfiguration { public class FrameworkConfiguration {
private boolean resultStyle = false; private boolean resultStyle = false;
@ -23,4 +21,24 @@ public class FrameworkConfiguration {
private boolean shortPassword = false; private boolean shortPassword = false;
private Supplier<String> codeSupplier = null; private Supplier<String> codeSupplier = null;
public FrameworkConfiguration resultStyle() {
this.resultStyle = true;
return this;
}
public FrameworkConfiguration debug() {
this.debug = true;
return this;
}
public FrameworkConfiguration shortPassword() {
this.shortPassword = true;
return this;
}
public FrameworkConfiguration codeSupplier(Supplier<String> codeSupplier) {
this.codeSupplier = codeSupplier;
return this;
}
} }

View File

@ -14,23 +14,19 @@ public interface Frameworks {
FrameworkConfiguration config = new FrameworkConfiguration(); FrameworkConfiguration config = new FrameworkConfiguration();
static FrameworkConfiguration resultStyle() { static FrameworkConfiguration resultStyle() {
config.setResultStyle(true); return config.resultStyle();
return config;
} }
static FrameworkConfiguration shortPassword() { static FrameworkConfiguration shortPassword() {
config.setShortPassword(true); return config.shortPassword();
return config;
} }
static FrameworkConfiguration debug() { static FrameworkConfiguration debug() {
config.setDebug(true); return config.debug();
return config;
} }
static FrameworkConfiguration codeSupplier(Supplier<String> codeSupplier) { static FrameworkConfiguration codeSupplier(Supplier<String> codeSupplier) {
config.setCodeSupplier(codeSupplier); return config.codeSupplier(codeSupplier);
return config;
} }
static String getCode() { static String getCode() {
@ -39,4 +35,6 @@ public interface Frameworks {
} }
return null; return null;
} }
} }