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

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

There is a newer version: 1.0.1
Show newest version
package com.malinskiy.sheldon.codegen.validator;

import com.google.common.collect.HashMultiset;

import com.malinskiy.sheldon.codegen.ProcessingException;

import java.util.Set;

import javax.annotation.Nonnull;

public class ConsistencyValidator {

    public static void checkConsistency(@Nonnull Set defaults,
                                        @Nonnull Set getters,
                                        @Nonnull Set setters) throws ProcessingException {

        if (!HashMultiset.create(setters).equals(HashMultiset.create(getters)) ||
            !HashMultiset.create(setters).equals(HashMultiset.create(defaults))) {

            throw new ProcessingException(null, "Incomplete interface definition (missing either getter, setter or " +
                                                "default)");
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy