add a 'reverse' property (default to false) to RequiresDialectFeature annotation
This commit is contained in:
parent
fc2051af71
commit
bbac6ed571
|
@ -63,7 +63,7 @@ public class DialectFilterExtension implements ExecutionCondition {
|
|||
if ( !effectiveRequiresDialects.isEmpty() ) {
|
||||
StringBuilder requiredDialects = new StringBuilder( );
|
||||
for ( RequiresDialect requiresDialect : effectiveRequiresDialects ) {
|
||||
requiredDialects.append(requiresDialect.value() );
|
||||
requiredDialects.append( requiresDialect.value() );
|
||||
requiredDialects.append( " " );
|
||||
if ( requiresDialect.matchSubTypes() ) {
|
||||
if ( requiresDialect.value().isInstance( dialect ) ) {
|
||||
|
@ -116,12 +116,15 @@ public class DialectFilterExtension implements ExecutionCondition {
|
|||
try {
|
||||
final DialectFeatureCheck dialectFeatureCheck = effectiveRequiresDialectFeature.feature()
|
||||
.newInstance();
|
||||
if ( !dialectFeatureCheck.apply( getDialect( context ) ) ) {
|
||||
final boolean applicable = dialectFeatureCheck.apply( getDialect( context ) );
|
||||
final boolean reverse = effectiveRequiresDialectFeature.reverse();
|
||||
if ( applicable ^ reverse ) {
|
||||
return ConditionEvaluationResult.disabled(
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
"Failed @RequiresDialectFeature [%s]",
|
||||
effectiveRequiresDialectFeature.feature()
|
||||
"Failed @RequiresDialectFeature [feature: %s, reverse: %s]",
|
||||
effectiveRequiresDialectFeature.feature(),
|
||||
effectiveRequiresDialectFeature.reverse()
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +133,7 @@ public class DialectFilterExtension implements ExecutionCondition {
|
|||
}
|
||||
}
|
||||
|
||||
return ConditionEvaluationResult.enabled( "Passed all @SkipForDialects" );
|
||||
return ConditionEvaluationResult.enabled( "Passed all @RequiresDialect(s), @SkipForDialect(s) and @RequiresDialectFeature(group)" );
|
||||
}
|
||||
|
||||
private Dialect getDialect(ExtensionContext context) {
|
||||
|
|
|
@ -142,12 +142,6 @@ abstract public class DialectFeatureChecks {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DoesRepeatableReadNotCauseReadersToBlockWritersCheck implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return ! dialect.doesRepeatableReadCauseReadersToBlockWriters();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SupportsExistsInSelectCheck implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return dialect.supportsExistsInSelect();
|
||||
|
@ -185,12 +179,6 @@ abstract public class DialectFeatureChecks {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DoesNotSupportRowValueConstructorSyntax implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return dialect.supportsRowValueConstructorSyntax() == false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DoesNotSupportFollowOnLocking implements DialectFeatureCheck {
|
||||
public boolean apply(Dialect dialect) {
|
||||
return !dialect.useFollowOnLocking( null, null );
|
||||
|
|
|
@ -33,6 +33,11 @@ public @interface RequiresDialectFeature {
|
|||
*/
|
||||
Class<? extends DialectFeatureCheck> feature();
|
||||
|
||||
/**
|
||||
* @return Whether the decision of {@link #feature()} is reversed
|
||||
*/
|
||||
boolean reverse() default false;
|
||||
|
||||
/**
|
||||
* Comment describing the reason why the feature is required.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue