com.github.dreamhead.moco.parser.model.MountSetting Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moco-runner Show documentation
Show all versions of moco-runner Show documentation
Moco is an easy setup stub framework, mainly focusing on testing and integration.
package com.github.dreamhead.moco.parser.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.github.dreamhead.moco.MocoMount;
import com.github.dreamhead.moco.ResponseHandler;
import com.github.dreamhead.moco.mount.MountPredicate;
import com.google.common.base.MoreObjects;
import java.util.List;
import java.util.stream.Stream;
import static com.google.common.collect.ImmutableList.of;
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
public final class MountSetting extends ResponseSetting {
private String dir;
private String uri;
private List includes = of();
private List excludes = of();
public String getDir() {
return dir;
}
public String getUri() {
return uri;
}
public MountPredicate[] getMountPredicates() {
return Stream.concat(
includes.stream().map(MocoMount::include),
excludes.stream().map(MocoMount::exclude))
.toArray(MountPredicate[]::new);
}
public ResponseHandler getResponseHandler() {
return this.asResponseSetting().getResponseHandler();
}
protected MoreObjects.ToStringHelper toStringHelper() {
return super.toStringHelper()
.add("dir", dir)
.add("uri", uri)
.add("includes", toStringList(includes))
.add("excludes", toStringList(excludes));
}
private List toStringList(final List includes) {
if (includes.isEmpty()) {
return null;
}
return includes;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy