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.Setter;
import lombok.experimental.Accessors;
import java.util.function.Supplier;
@ -11,9 +10,8 @@ import java.util.function.Supplier;
*
* @author wangyu
*/
@Setter
@Getter
@Accessors(chain = true)
@Setter
public class FrameworkConfiguration {
private boolean resultStyle = false;
@ -23,4 +21,24 @@ public class FrameworkConfiguration {
private boolean shortPassword = false;
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();
static FrameworkConfiguration resultStyle() {
config.setResultStyle(true);
return config;
return config.resultStyle();
}
static FrameworkConfiguration shortPassword() {
config.setShortPassword(true);
return config;
return config.shortPassword();
}
static FrameworkConfiguration debug() {
config.setDebug(true);
return config;
return config.debug();
}
static FrameworkConfiguration codeSupplier(Supplier<String> codeSupplier) {
config.setCodeSupplier(codeSupplier);
return config;
return config.codeSupplier(codeSupplier);
}
static String getCode() {
@ -39,4 +35,6 @@ public interface Frameworks {
}
return null;
}
}