mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-25 00:52:31 -04:00
Refactor
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package io.xpipe.core.charsetter;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -11,6 +12,7 @@ public enum NewLine {
|
||||
CRLF("\r\n", "crlf");
|
||||
|
||||
private final String newLine;
|
||||
@Getter
|
||||
private final String id;
|
||||
|
||||
NewLine(String newLine, String id) {
|
||||
@@ -36,7 +38,4 @@ public enum NewLine {
|
||||
return newLine;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import lombok.ToString;
|
||||
public class BaseQueryElement extends DialogElement {
|
||||
|
||||
private final String description;
|
||||
@Getter
|
||||
private final boolean newLine;
|
||||
private final boolean required;
|
||||
private final boolean secret;
|
||||
@@ -35,10 +36,6 @@ public class BaseQueryElement extends DialogElement {
|
||||
return required && value == null;
|
||||
}
|
||||
|
||||
public boolean isNewLine() {
|
||||
return newLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDisplayString() {
|
||||
return description;
|
||||
|
||||
@@ -14,11 +14,15 @@ import java.util.List;
|
||||
@Getter
|
||||
public class ChoiceElement extends DialogElement {
|
||||
|
||||
@Getter
|
||||
private final String description;
|
||||
@Getter
|
||||
private final List<Choice> elements;
|
||||
@Getter
|
||||
private final boolean required;
|
||||
private final boolean quiet;
|
||||
|
||||
@Getter
|
||||
private int selected;
|
||||
|
||||
@JsonCreator
|
||||
@@ -76,19 +80,4 @@ public class ChoiceElement extends DialogElement {
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Choice> getElements() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
public int getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public boolean isRequired() {
|
||||
return required;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package io.xpipe.core.dialog;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
|
||||
@@ -27,7 +29,4 @@ public abstract class DialogElement {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package io.xpipe.core.dialog;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@JsonTypeName("header")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@@ -27,7 +29,4 @@ public class HeaderElement extends DialogElement {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getHeader() {
|
||||
return header;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface ShellControl extends ProcessControl {
|
||||
s.setOsName(shellControl.getOsName());
|
||||
store.setState(s);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
default ShellControl withSupportCheckInit(Predicate<ShellControl> predicate, String name) {
|
||||
return onInit(shellControl -> {
|
||||
@@ -52,7 +52,7 @@ public interface ShellControl extends ProcessControl {
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
default <T extends ShellStoreState> ShellControl withShellStateFail(StatefulDataStore<T> store) {
|
||||
return onFail(shellControl -> {
|
||||
@@ -60,7 +60,7 @@ public interface ShellControl extends ProcessControl {
|
||||
s.setRunning(false);
|
||||
store.setState(s);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
ShellControl onExit(Consumer<ShellControl> pc);
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package io.xpipe.core.store;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DataFlow {
|
||||
@JsonProperty("input")
|
||||
INPUT("Input"),
|
||||
@@ -28,7 +30,4 @@ public enum DataFlow {
|
||||
return this == OUTPUT || this == INPUT_OUTPUT;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@Getter
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode
|
||||
public abstract class EncryptedSecretValue implements SecretValue {
|
||||
|
||||
@Getter
|
||||
String encryptedValue;
|
||||
|
||||
public EncryptedSecretValue(char[] c) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -16,6 +17,7 @@ public class JacksonMapper {
|
||||
|
||||
private static final ObjectMapper BASE = new ObjectMapper();
|
||||
private static final ObjectMapper INSTANCE;
|
||||
@Getter
|
||||
private static boolean init = false;
|
||||
|
||||
public static <T> T parse(String s, Class<T> c) throws JsonProcessingException {
|
||||
@@ -85,7 +87,4 @@ public class JacksonMapper {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public static boolean isInit() {
|
||||
return init;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
public enum XPipeDaemonMode {
|
||||
@JsonProperty("background")
|
||||
BACKGROUND("background", List.of("base", "background")),
|
||||
@@ -29,10 +30,8 @@ public enum XPipeDaemonMode {
|
||||
.collect(Collectors.joining(", "))));
|
||||
}
|
||||
|
||||
@Getter
|
||||
private final String displayName;
|
||||
|
||||
@Getter
|
||||
private final List<String> nameAlternatives;
|
||||
|
||||
XPipeDaemonMode(String displayName, List<String> nameAlternatives) {
|
||||
|
||||
Reference in New Issue
Block a user