package com.bloatit.framework.webprocessor.url.constraints;

import java.math.BigDecimal;

import com.bloatit.framework.exceptions.highlevel.BadProgrammerException;
import com.bloatit.framework.webprocessor.annotations.MessageFormater;

public abstract class MinMaxConstraint<V extends Comparable<V>> extends Constraint<V> {
    protected final boolean isExclusive;
    protected final Integer minMax;

    public MinMaxConstraint(final String message, final int minMax, final boolean isExclusive) {
        super(message);
        this.minMax = minMax;
        this.isExclusive = isExclusive;
    }

    @Override
    protected void updateFormater(final MessageFormater formater, V value) {
        formater.addParameter("%constraint%", String.valueOf(minMax));

        if (value instanceof String) {
            formater.addParameter("%valueLength%", String.valueOf(((String) value).length()));
        }

    }

    @Override
    public boolean verify(final V value) {
        if (value == null) {
            return true;
        }
        
        // Weird hack :
        final Object hacked = value;

        if (hacked instanceof BigDecimal) {
            return cmp(isExclusive, (new BigDecimal(minMax).compareTo((BigDecimal) hacked)));
        }
        if (hacked instanceof String) {
            return cmp(isExclusive, (minMax.compareTo(((String) hacked).length())));
        }
        try {
            @SuppressWarnings("unchecked") final Comparable<V> theMin = value.getClass().cast(minMax);
            return cmp(isExclusive, theMin.compareTo(value));
        } catch (final ClassCastException e) {
            throw new BadProgrammerException("Constraint not allowed on this Class.", e);
        }
    }

    public abstract boolean cmp(boolean exclusive, int value);
}
@@ -769,21 +769,32 @@
     if (
+((Object) 
 value
+)
  instanc
@@ -873,26 +873,34 @@
 valueOf(
-((
 String
-) 
+.class.cast(
 value).l
@@ -1049,24 +1049,16 @@
       %7D%0A
-        
 %0A       
@@ -1792,8 +1792,9 @@
 alue);%0A%7D
+%0A

Fix compilation issue on some version of openJdk