Skip to content

Instantly share code, notes, and snippets.

@BumpeiShimada
Last active November 16, 2018 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BumpeiShimada/48ac2bdf3d9811c191f3a5c65b8ce433 to your computer and use it in GitHub Desktop.
Save BumpeiShimada/48ac2bdf3d9811c191f3a5c65b8ce433 to your computer and use it in GitHub Desktop.
/**
* Types for categorizing validation classes
*/
enum ValidateType {
/**
* Applicable to all events
*/
ALL_EVENTS,
/**
* Only applicable when the event is an exclusive one
*/
EXCLUSIVE_EVENT_ONLY,
/**
* Only applicable when the event is "not" an exclusive one
*/
PUBLIC_EVENT_ONLY;
/**
* This returns what kind of validation class will be applicable to the target Event.
* It's only used in ValidatorFactory class for filtering unnecessary validation class.
*
* @param isExclusive: the boolean value indicate whether the event is the exclusive one or not
* @return Validate types to use this case
*/
public static EnumSet<ValidateType> getEventTypes(boolean isExclusive) {
if (isExclusive) {
return EnumSet.of(ALL_EVENTS, EXCLUSIVE_EVENT_ONLY);
}
return EnumSet.of(ALL_EVENTS, PUBLIC_EVENT_ONLY);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment