@@ -25,7 +25,7 @@ public class PgContext {
25
25
/**
26
26
* Default bloat percentage threshold.
27
27
*/
28
- public static final int DEFAULT_BLOAT_PERCENTAGE_THRESHOLD = 10 ;
28
+ public static final double DEFAULT_BLOAT_PERCENTAGE_THRESHOLD = 10.0 ;
29
29
/**
30
30
* Default schema name.
31
31
*/
@@ -36,13 +36,12 @@ public class PgContext {
36
36
public static final double DEFAULT_REMAINING_PERCENTAGE_THRESHOLD = 10.0 ;
37
37
38
38
private final String schemaName ;
39
- private final int bloatPercentageThreshold ;
39
+ private final double bloatPercentageThreshold ;
40
40
private final double remainingPercentageThreshold ;
41
41
42
- private PgContext (@ Nonnull final String schemaName , final int bloatPercentageThreshold , final double remainingPercentageThreshold ) {
42
+ private PgContext (@ Nonnull final String schemaName , final double bloatPercentageThreshold , final double remainingPercentageThreshold ) {
43
43
this .schemaName = Validators .notBlank (schemaName , "schemaName" ).toLowerCase (Locale .ROOT );
44
- this .bloatPercentageThreshold = Validators .argumentNotNegative (
45
- bloatPercentageThreshold , "bloatPercentageThreshold" );
44
+ this .bloatPercentageThreshold = Validators .validPercent (bloatPercentageThreshold , "bloatPercentageThreshold" );
46
45
this .remainingPercentageThreshold = Validators .validPercent (remainingPercentageThreshold , "remainingPercentageThreshold" );
47
46
}
48
47
@@ -70,7 +69,7 @@ public boolean isDefaultSchema() {
70
69
*
71
70
* @return bloat percentage threshold
72
71
*/
73
- public int getBloatPercentageThreshold () {
72
+ public double getBloatPercentageThreshold () {
74
73
return bloatPercentageThreshold ;
75
74
}
76
75
@@ -128,7 +127,9 @@ public String enrichWithSchema(@Nonnull final String objectName) {
128
127
* @return {@code PgContext}
129
128
*/
130
129
@ Nonnull
131
- public static PgContext of (@ Nonnull final String schemaName , final int bloatPercentageThreshold , final double remainingPercentageThreshold ) {
130
+ public static PgContext of (@ Nonnull final String schemaName ,
131
+ final double bloatPercentageThreshold ,
132
+ final double remainingPercentageThreshold ) {
132
133
return new PgContext (schemaName , bloatPercentageThreshold , remainingPercentageThreshold );
133
134
}
134
135
@@ -141,7 +142,8 @@ public static PgContext of(@Nonnull final String schemaName, final int bloatPerc
141
142
* @see PgContext#DEFAULT_REMAINING_PERCENTAGE_THRESHOLD
142
143
*/
143
144
@ Nonnull
144
- public static PgContext of (@ Nonnull final String schemaName , final int bloatPercentageThreshold ) {
145
+ public static PgContext of (@ Nonnull final String schemaName ,
146
+ final double bloatPercentageThreshold ) {
145
147
return new PgContext (schemaName , bloatPercentageThreshold , DEFAULT_REMAINING_PERCENTAGE_THRESHOLD );
146
148
}
147
149
0 commit comments