aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/events
diff options
context:
space:
mode:
authorSimon Pepping <spepping@apache.org>2011-01-14 12:58:53 +0000
committerSimon Pepping <spepping@apache.org>2011-01-14 12:58:53 +0000
commit1eaae07e7db29a870d7dd037083a3e0fc9f7dc8c (patch)
treeed323cef97a5b32384b914229211a5e79cbcb9e9 /src/java/org/apache/fop/events
parent4c8a18e4a5e33f473150b9e2f4a91461cb67cce9 (diff)
downloadxmlgraphics-fop-1eaae07e7db29a870d7dd037083a3e0fc9f7dc8c.tar.gz
xmlgraphics-fop-1eaae07e7db29a870d7dd037083a3e0fc9f7dc8c.zip
Fix deprecation warnings; add some type safety
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1058988 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/events')
-rw-r--r--src/java/org/apache/fop/events/Event.java13
-rw-r--r--src/java/org/apache/fop/events/EventExceptionManager.java11
-rw-r--r--src/java/org/apache/fop/events/PropertyExceptionFactory.java2
-rw-r--r--src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java2
-rw-r--r--src/java/org/apache/fop/events/ValidationExceptionFactory.java2
5 files changed, 16 insertions, 14 deletions
diff --git a/src/java/org/apache/fop/events/Event.java b/src/java/org/apache/fop/events/Event.java
index c48530c1c..ffec9473e 100644
--- a/src/java/org/apache/fop/events/Event.java
+++ b/src/java/org/apache/fop/events/Event.java
@@ -38,7 +38,7 @@ public class Event extends EventObject {
private String eventKey;
private EventSeverity severity;
- private Map params;
+ private Map<String, Object> params;
/**
* Creates a new Event.
@@ -47,7 +47,8 @@ public class Event extends EventObject {
* @param severity the severity level
* @param params the event parameters (a map of name/value pairs)
*/
- public Event(Object source, String eventID, EventSeverity severity, Map params) {
+ public Event(Object source, String eventID, EventSeverity severity, Map<String, Object> params)
+ {
super(source);
int pos = eventID.lastIndexOf('.');
if (pos < 0 || pos == eventID.length() - 1) {
@@ -122,7 +123,7 @@ public class Event extends EventObject {
* Returns an unmodifiable {@link java.util.Map} with all event parameters.
* @return the parameter map
*/
- public Map getParams() {
+ public Map<String, Object> getParams() {
return Collections.unmodifiableMap(this.params);
}
@@ -138,7 +139,7 @@ public class Event extends EventObject {
* This class is a fluent builder class for building up the parameter map.
*/
public static class ParamsBuilder {
- private Map params;
+ private Map<String, Object> params;
/**
* Adds a new parameter (a name/value pair).
@@ -148,7 +149,7 @@ public class Event extends EventObject {
*/
public ParamsBuilder param(String name, Object value) {
if (this.params == null) {
- this.params = new java.util.HashMap();
+ this.params = new java.util.HashMap<String, Object>();
}
this.params.put(name, value);
return this;
@@ -158,7 +159,7 @@ public class Event extends EventObject {
* Returns the accumulated parameter map.
* @return the accumulated parameter map
*/
- public Map build() {
+ public Map<String, Object> build() {
return this.params;
}
}
diff --git a/src/java/org/apache/fop/events/EventExceptionManager.java b/src/java/org/apache/fop/events/EventExceptionManager.java
index f7d679282..3494dc560 100644
--- a/src/java/org/apache/fop/events/EventExceptionManager.java
+++ b/src/java/org/apache/fop/events/EventExceptionManager.java
@@ -32,11 +32,12 @@ public final class EventExceptionManager {
private EventExceptionManager() {
}
- private static final Map EXCEPTION_FACTORIES = new java.util.HashMap();
+ private static final Map<String, ExceptionFactory> EXCEPTION_FACTORIES
+ = new java.util.HashMap<String, ExceptionFactory>();
static {
- Iterator iter;
- iter = Service.providers(ExceptionFactory.class, true);
+ Iterator<Object> iter;
+ iter = Service.providers(ExceptionFactory.class);
while (iter.hasNext()) {
ExceptionFactory factory = (ExceptionFactory)iter.next();
EXCEPTION_FACTORIES.put(factory.getExceptionClass().getName(), factory);
@@ -63,7 +64,7 @@ public final class EventExceptionManager {
String msg = EventFormatter.format(event);
//Get original exception as cause if it is given as one of the parameters
Throwable t = null;
- Iterator iter = event.getParams().values().iterator();
+ Iterator<Object> iter = event.getParams().values().iterator();
while (iter.hasNext()) {
Object o = iter.next();
if (o instanceof Throwable) {
@@ -96,6 +97,6 @@ public final class EventExceptionManager {
* Returns the {@link Exception} class created by this factory.
* @return the exception class
*/
- Class getExceptionClass();
+ Class<? extends Exception> getExceptionClass();
}
}
diff --git a/src/java/org/apache/fop/events/PropertyExceptionFactory.java b/src/java/org/apache/fop/events/PropertyExceptionFactory.java
index 753019b31..d8c7f39fb 100644
--- a/src/java/org/apache/fop/events/PropertyExceptionFactory.java
+++ b/src/java/org/apache/fop/events/PropertyExceptionFactory.java
@@ -40,7 +40,7 @@ public class PropertyExceptionFactory implements ExceptionFactory {
}
/** {@inheritDoc} */
- public Class getExceptionClass() {
+ public Class<PropertyException> getExceptionClass() {
return PropertyException.class;
}
diff --git a/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java b/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java
index 7ec9d19b2..570fcbd64 100644
--- a/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java
+++ b/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java
@@ -36,7 +36,7 @@ public class UnsupportedOperationExceptionFactory implements ExceptionFactory {
}
/** {@inheritDoc} */
- public Class getExceptionClass() {
+ public Class<UnsupportedOperationException> getExceptionClass() {
return UnsupportedOperationException.class;
}
diff --git a/src/java/org/apache/fop/events/ValidationExceptionFactory.java b/src/java/org/apache/fop/events/ValidationExceptionFactory.java
index 760c4ec58..2c7c69ce9 100644
--- a/src/java/org/apache/fop/events/ValidationExceptionFactory.java
+++ b/src/java/org/apache/fop/events/ValidationExceptionFactory.java
@@ -43,7 +43,7 @@ public class ValidationExceptionFactory implements ExceptionFactory {
}
/** {@inheritDoc} */
- public Class getExceptionClass() {
+ public Class<ValidationException> getExceptionClass() {
return ValidationException.class;
}