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

com.malinskiy.sheldon.codegen.validator.ContainsValidator Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
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 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