restx.description.ResourceDescription Maven / Gradle / Ivy
package restx.description;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
import java.util.List;
/**
* User: xavierhanin
* Date: 2/7/13
* Time: 10:53 AM
*/
public class ResourceDescription {
public String path;
public String stdPath;
public String description = "";
public List operations = Lists.newArrayList();
public static class Matcher implements Predicate {
private Predicate pathMatcher = Predicates.alwaysTrue();
private Predicate stdPathMatcher = Predicates.alwaysTrue();
private Predicate descriptionMatcher = Predicates.alwaysTrue();
public Matcher withPathMatcher(Predicate pathMatcher) {
this.pathMatcher = pathMatcher;
return this;
}
public Matcher withStdPathMatcher(Predicate stdPathMatcher) {
this.stdPathMatcher = stdPathMatcher;
return this;
}
public Matcher withDescriptionMatcher(Predicate descriptionMatcher) {
this.descriptionMatcher = descriptionMatcher;
return this;
}
public boolean apply(ResourceDescription description) {
return pathMatcher.apply(description.path)
&& stdPathMatcher.apply(description.stdPath)
&& descriptionMatcher.apply(description.description);
}
}
}