All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dreamhead.moco.resource.Resource Maven / Gradle / Ivy

Go to download

Moco is an easy setup stub framework, mainly focusing on testing and integration.

There is a newer version: 1.5.0
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy