0

To create conditionally validated groups with jsr 303 validation, an interface class is passed to the annotation like this:

@NotEmpty (groups={UpdateValue.class})

I have quite a few different interface types that I want to group in a parent interface in order to organize my code. Is this pattern ok? Should the child interfaces be static or non-static? Should the parent interface be static or non-static?

Here's an example of the interface I want to create:

package com.value.validationTypes;
public interface IValidation {
    public interface NewValue {
    }
    public interface UpdateValue {
    }
}

and the way I would use it in my form bean:

@NotEmpty (groups={IValidation.UpdateValue.class})
coder
  • 6,111
  • 19
  • 54
  • 73

1 Answers1

1

Inner interfaces are implicitly public static, they cannot be anything else.

Whether you make them explicitly public or static is a matter of taste IMHO.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130