Skip to content

Remove unneded model stuff #687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;

public class JavaModel implements WorkflowModel {
Expand All @@ -37,17 +36,6 @@ protected void setObject(Object object) {
this.object = object;
}

@Override
public void forEach(BiConsumer<String, WorkflowModel> consumer) {
asMap()
.ifPresent(
m ->
m.forEach(
(k, v) ->
consumer.accept(
k, v instanceof WorkflowModel model ? model : new JavaModel(v))));
}

@Override
public Optional<Boolean> asBoolean() {
return object instanceof Boolean value ? Optional.of(value) : Optional.empty();
Expand Down Expand Up @@ -99,11 +87,6 @@ static Object asJavaObject(Object object) {
}
}

@Override
public Object asIs() {
return object;
}

@Override
public Class<?> objectClass() {
return object != null ? object.getClass() : Object.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ public Object asJavaObject() {
return object;
}

@Override
public Object asIs() {
return object;
}

@Override
public Class<?> objectClass() {
return object.getClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
import java.util.function.BiConsumer;

public interface WorkflowModel {

void forEach(BiConsumer<String, WorkflowModel> consumer);

Optional<Boolean> asBoolean();

Collection<WorkflowModel> asCollection();
Expand All @@ -39,8 +36,6 @@ public interface WorkflowModel {

Object asJavaObject();

Object asIs();

Class<?> objectClass();

<T> Optional<T> as(Class<T> clazz);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.function.BiConsumer;

@JsonSerialize(using = JacksonModelSerializer.class)
public class JacksonModel implements WorkflowModel {
Expand All @@ -42,11 +41,6 @@ public class JacksonModel implements WorkflowModel {
this.node = node;
}

@Override
public void forEach(BiConsumer<String, WorkflowModel> consumer) {
node.forEachEntry((k, v) -> consumer.accept(k, new JacksonModel(v)));
}

@Override
public Optional<Boolean> asBoolean() {
return node.isBoolean() ? Optional.of(node.asBoolean()) : Optional.empty();
Expand Down Expand Up @@ -97,11 +91,6 @@ public Object asJavaObject() {
return JsonUtils.toJavaValue(node);
}

@Override
public Object asIs() {
return node;
}

@Override
public Class<?> objectClass() {
return node.getClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ public Object asJavaObject() {
return JsonUtils.toJavaValue(node);
}

@Override
public Object asIs() {
return node;
}

@Override
public Class<?> objectClass() {
return ArrayNode.class;
Expand Down
Loading