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

io.envoyproxy.pgv.EnumValidation Maven / Gradle / Ivy

There is a newer version: 0.6.13
Show newest version
package io.envoyproxy.pgv;

import com.google.protobuf.ProtocolMessageEnum;

/**
 * {@code EnumValidation} implements PGV validation for protobuf enumerated types.
 */
public final class EnumValidation {
    private EnumValidation() {
    }

    public static void definedOnly(String field, ProtocolMessageEnum value) throws ValidationException {
        if (value.toString().equals("UNRECOGNIZED")) {
            throw new ValidationException(field, value, "value is not a defined Enum value " + value);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy