src/share/classes/javax/swing/text/InternationalFormatter.java
Print this page
@@ -104,15 +104,15 @@
*/
private Format format;
/**
* Can be used to impose a maximum value.
*/
- private Comparable max;
+ private Comparable<?> max;
/**
* Can be used to impose a minimum value.
*/
- private Comparable min;
+ private Comparable<?> min;
/**
* <code>InternationalFormatter</code>'s behavior is dicatated by a
* <code>AttributedCharacterIterator</code> that is obtained from
* the <code>Format</code>. On every edit, assuming
@@ -209,11 +209,11 @@
* <code>minimum</code>.
*
* @param minimum Minimum legal value that can be input
* @see #setValueClass
*/
- public void setMinimum(Comparable minimum) {
+ public void setMinimum(Comparable<?> minimum) {
if (getValueClass() == null && minimum != null) {
setValueClass(minimum.getClass());
}
min = minimum;
}
@@ -221,11 +221,11 @@
/**
* Returns the minimum permissible value.
*
* @return Minimum legal value that can be input
*/
- public Comparable getMinimum() {
+ public Comparable<?> getMinimum() {
return min;
}
/**
* Sets the maximum permissible value. If the <code>valueClass</code> has
@@ -234,11 +234,11 @@
* <code>max</code>.
*
* @param max Maximum legal value that can be input
* @see #setValueClass
*/
- public void setMaximum(Comparable max) {
+ public void setMaximum(Comparable<?> max) {
if (getValueClass() == null && max != null) {
setValueClass(max.getClass());
}
this.max = max;
}
@@ -246,11 +246,11 @@
/**
* Returns the maximum permissible value.
*
* @return Maximum legal value that can be input
*/
- public Comparable getMaximum() {
+ public Comparable<?> getMaximum() {
return max;
}
/**
* Installs the <code>DefaultFormatter</code> onto a particular
@@ -409,11 +409,12 @@
* @param wantsCCE If false, and a ClassCastException is thrown in
* comparing the values, the exception is consumed and
* false is returned.
*/
boolean isValidValue(Object value, boolean wantsCCE) {
- Comparable min = getMinimum();
+ @SuppressWarnings("unchecked")
+ Comparable<Object> min = (Comparable<Object>)getMinimum();
try {
if (min != null && min.compareTo(value) > 0) {
return false;
}
@@ -422,11 +423,12 @@
throw cce;
}
return false;
}
- Comparable max = getMaximum();
+ @SuppressWarnings("unchecked")
+ Comparable<Object> max = (Comparable<Object>)getMaximum();
try {
if (max != null && max.compareTo(value) < 0) {
return false;
}
} catch (ClassCastException cce) {
@@ -768,11 +770,11 @@
}
/**
* Returns true if <code>attributes</code> is null or empty.
*/
- boolean isLiteral(Map attributes) {
+ boolean isLiteral(Map<?, ?> attributes) {
return ((attributes == null) || attributes.size() == 0);
}
/**
* Updates the interal bitset from <code>iterator</code>. This will
@@ -795,11 +797,11 @@
}
}
iterator.first();
while (iterator.current() != CharacterIterator.DONE) {
- Map attributes = iterator.getAttributes();
+ Map<Attribute,Object> attributes = iterator.getAttributes();
boolean set = isLiteral(attributes);
int start = iterator.getIndex();
int end = iterator.getRunLimit();
while (start < end) {
@@ -856,11 +858,11 @@
}
/**
* Returns the field that will be adjusted by adjustValue.
*/
- Object getAdjustField(int start, Map attributes) {
+ Object getAdjustField(int start, Map<?, ?> attributes) {
return null;
}
/**
* Returns the number of occurrences of <code>f</code> before
@@ -898,11 +900,11 @@
* the actual incrementing. <code>value</code> is the current value,
* <code>attributes</code> gives the field the cursor is in (may be
* null depending upon <code>canIncrement</code>) and
* <code>direction</code> is the amount to increment by.
*/
- Object adjustValue(Object value, Map attributes, Object field,
+ Object adjustValue(Object value, Map<?, ?> attributes, Object field,
int direction) throws
BadLocationException, ParseException {
return null;
}
@@ -1021,11 +1023,11 @@
if (start != -1) {
AttributedCharacterIterator iterator = getIterator();
iterator.setIndex(start);
- Map attributes = iterator.getAttributes();
+ Map<Attribute,Object> attributes = iterator.getAttributes();
Object field = getAdjustField(start, attributes);
if (canIncrement(field, start)) {
try {
Object value = stringToValue(