com.github.dreamhead.moco.resource.Resource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moco-core Show documentation
Show all versions of moco-core Show documentation
Moco is an easy setup stub framework, mainly focusing on testing and integration.
package com.github.dreamhead.moco.resource;
import com.github.dreamhead.moco.ConfigApplier;
import com.github.dreamhead.moco.MocoConfig;
import com.github.dreamhead.moco.Request;
import com.github.dreamhead.moco.model.MessageContent;
import com.google.common.base.Optional;
public class Resource implements Identifiable, ConfigApplier, ResourceReader {
private Identifiable identifiable;
private ResourceConfigApplier configApplier;
protected ResourceReader reader;
public Resource(final Identifiable identifiable, final ResourceConfigApplier configApplier, final ResourceReader reader) {
this.identifiable = identifiable;
this.configApplier = configApplier;
this.reader = reader;
}
@Override
public Resource apply(final MocoConfig config) {
return configApplier.apply(config, this);
}
@Override
public String id() {
return identifiable.id();
}
@Override
public MessageContent readFor(final Optional request) {
return reader.readFor(request);
}
}