
com.malinskiy.sheldon.codegen.validator.ContainsValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compiler Show documentation
Show all versions of compiler Show documentation
Reactive preferences abstraction
package com.malinskiy.sheldon.codegen.validator;
import com.google.auto.common.MoreTypes;
import com.malinskiy.sheldon.codegen.ProcessingException;
import java.util.List;
import javax.annotation.Nonnull;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.VariableElement;
import rx.Observable;
public class ContainsValidator {
public static void checkValidContainsMethod(@Nonnull ExecutableElement method) throws ProcessingException {
List extends VariableElement> parameters = method.getParameters();
if (parameters.size() != 1) {
throw new ProcessingException(method,
"Invalid number of parameters for contains method. Should be one String parameter");
}
if (!MoreTypes.isTypeOf(Observable.class, method.getReturnType())) {
throw new ProcessingException(
method,
"Should return Observable"
);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy