aboutsummaryrefslogtreecommitdiffstats
path: root/fop-events
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2016-09-16 11:17:35 +0000
committerSimon Steiner <ssteiner@apache.org>2016-09-16 11:17:35 +0000
commit46b7e0614c3251dbb50ea97211d8d79af3dedade (patch)
treee486dff4f9b4671e698ead8f9bc05660c33edd3d /fop-events
parent36d81a0a715e65525e326c6911ac4859fec63968 (diff)
downloadxmlgraphics-fop-46b7e0614c3251dbb50ea97211d8d79af3dedade.tar.gz
xmlgraphics-fop-46b7e0614c3251dbb50ea97211d8d79af3dedade.zip
FOP-2648: Code cleanup, use foreach
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1761020 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'fop-events')
-rw-r--r--fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java4
-rw-r--r--fop-events/src/main/java/org/apache/fop/tools/EventProducerCollector.java9
-rw-r--r--fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java6
3 files changed, 7 insertions, 12 deletions
diff --git a/fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java b/fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java
index 596a0a86b..24499ea35 100644
--- a/fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java
+++ b/fop-events/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java
@@ -104,8 +104,8 @@ public class DefaultEventBroadcaster implements EventBroadcaster {
}
private static synchronized EventProducerModel getEventProducerModel(Class clazz) {
- for (int i = 0, c = eventModels.size(); i < c; i++) {
- EventModel eventModel = (EventModel)eventModels.get(i);
+ for (Object eventModel1 : eventModels) {
+ EventModel eventModel = (EventModel) eventModel1;
EventProducerModel producerModel = eventModel.getProducer(clazz);
if (producerModel != null) {
return producerModel;
diff --git a/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollector.java b/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollector.java
index 7151f5a9c..2351fc870 100644
--- a/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollector.java
+++ b/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollector.java
@@ -93,8 +93,7 @@ class EventProducerCollector {
builder.addSource(src);
JavaClass[] classes = builder.getClasses();
boolean eventProducerFound = false;
- for (int i = 0, c = classes.length; i < c; i++) {
- JavaClass clazz = classes[i];
+ for (JavaClass clazz : classes) {
if (clazz.isInterface() && implementsInterface(clazz, CLASSNAME_EVENT_PRODUCER)) {
processEventProducerInterface(clazz);
eventProducerFound = true;
@@ -105,8 +104,7 @@ class EventProducerCollector {
private boolean implementsInterface(JavaClass clazz, String intf) {
JavaClass[] classes = clazz.getImplementedInterfaces();
- for (int i = 0, c = classes.length; i < c; i++) {
- JavaClass cl = classes[i];
+ for (JavaClass cl : classes) {
if (cl.getFullyQualifiedName().equals(intf)) {
return true;
}
@@ -124,8 +122,7 @@ class EventProducerCollector {
throws EventConventionException, ClassNotFoundException {
EventProducerModel prodMeta = new EventProducerModel(clazz.getFullyQualifiedName());
JavaMethod[] methods = clazz.getMethods(true);
- for (int i = 0, c = methods.length; i < c; i++) {
- JavaMethod method = methods[i];
+ for (JavaMethod method : methods) {
EventMethodModel methodMeta = createMethodModel(method);
prodMeta.addMethod(methodMeta);
}
diff --git a/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java b/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java
index 85c10f09a..f56eea2e4 100644
--- a/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java
+++ b/fop-events/src/main/java/org/apache/fop/tools/EventProducerCollectorTask.java
@@ -67,8 +67,7 @@ public class EventProducerCollectorTask extends Task {
try {
EventProducerCollector collector = new EventProducerCollector();
long lastModified = processFileSets(collector);
- for (Iterator iter = collector.getModels().iterator(); iter.hasNext();) {
- EventModel model = (EventModel) iter.next();
+ for (EventModel model : collector.getModels()) {
File parentDir = getParentDir(model);
if (!parentDir.exists() && !parentDir.mkdirs()) {
throw new BuildException(
@@ -208,8 +207,7 @@ public class EventProducerCollectorTask extends Task {
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] srcFiles = ds.getIncludedFiles();
File directory = fs.getDir(getProject());
- for (int i = 0, c = srcFiles.length; i < c; i++) {
- String filename = srcFiles[i];
+ for (String filename : srcFiles) {
File src = new File(directory, filename);
boolean eventProducerFound = collector.scanFile(src);
if (eventProducerFound) {