RequiredField

public final class RequiredField implements ValidatingOption<T, C, K>

A message option that defines a combination of required fields for the message.

The fields are separated with a | symbol and combined with a & symbol.

Example:


    message PersonName {
        option (required_field) = "given_name|honorific_prefix & family_name";
        string honorific_prefix = 1;
        string given_name = 2;
        string middle_name = 3;
    }
    

The PersonName message is valid against the RequiredField either if it has a non-default family name, or both honorific prefix and a family name.

Functions

Link copied to clipboard
public Constraint constraintFor(MessageType messageType)
Creates a Constraint for the given field based on the value of the option.
Link copied to clipboard
public Optional<String> valueFrom(Descriptors.Descriptor message)

Inherited functions

Link copied to clipboard
public boolean valuePresent(K object)