Skip to content

Commit

Permalink
Merge pull request #370 from rubenporras/ReduceOverheadOfFiringValida…
Browse files Browse the repository at this point in the history
…tions

Reduce overhead of firing validations
  • Loading branch information
rubenporras authored Mar 4, 2021
2 parents 3b68a96 + c63ed79 commit 5096d1d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ abstract public class
final public void check�checkKind.toString().toFirstUpper()��contextType.name�(�contextType.name� context) {
ICheckSequencer sequencer = pre�checkKind.toString().toFirstUpper()�Check�contextType.name�(context);
assert sequencer != null : "Sequencer must be initialized";
boolean isDebugEnabled = LOGGER.isDebugEnabled();
�FOREACH validModel.getAllNativeRules(checkKind).contexts.select(c| c.contextType == contextType).sortBy(c|c.name()) AS context -�
if (LOGGER.isDebugEnabled()) {
if (isDebugEnabled) {
LOGGER.debug(NLS.bind("Performing check:{0} on {1}", "�context.name()�", context));
}
check�context.name()�(context, sequencer);
Expand All @@ -129,13 +130,13 @@ abstract public class
}

/**
* Returns a check sequencer for the given Check (Kind/Context) family.
* Returns the default check sequencer for the given Check (Kind/Context) family.
*
* @param context the context object
* @return a check sequencer (possibly enriched with user data)
* @return the default check sequencer
*/
public ICheckSequencer pre�checkKind.toString().toFirstUpper()�Check�contextType.name�(�contextType.name� context) {
return new DefaultCheckSequencer();
return DefaultCheckSequencer.getInstance();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
*/
public class DefaultCheckSequencer implements ICheckSequencer {

/**
* The singletone.
*/
private static final DefaultCheckSequencer INSTANCE = new DefaultCheckSequencer();

/**
* The singletone instance for the default check sequencer.
*
* @return the singletone instance
*/
public static DefaultCheckSequencer getInstance() {
return INSTANCE;
}

/**
* Default implementation for canContinue.
*
Expand Down

0 comments on commit 5096d1d

Please sign in to comment.