From 24ad39eec2a0fdca1ef9768de0b92e45a34c1a24 Mon Sep 17 00:00:00 2001 From: ulrich Date: Tue, 03 Dec 2024 13:35:37 +0000 Subject: [PATCH] Anwendungsspezifische Parameter im Scanner auf generisches Object-Array umgestellt --- src/de/uhilger/neon/Factory.java | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/de/uhilger/neon/Factory.java b/src/de/uhilger/neon/Factory.java index 7cb2a86..3748d5b 100644 --- a/src/de/uhilger/neon/Factory.java +++ b/src/de/uhilger/neon/Factory.java @@ -187,9 +187,7 @@ ctxAttrs.putAll(cd.attributes); if (h instanceof Handler) { for (String packageName : packageNames) { - wireActors(scn, - packageName, (Handler) h, - cd.attributes.get("contextName")); + scn.process(this, packageName, (Handler) h, cd.attributes.get("contextName")); ctx.getAttributes().put("serverDataProviderList", sdp); } } @@ -262,15 +260,6 @@ | InvocationTargetException ex) { // Klasse nicht gefunden. Muss das geloggt oder sonstwie behandel werden? return null; - } - } - - @SuppressWarnings("unchecked") - private void wireActors(Scanner scn, String packageName, /*Class annotation, */Handler h, String contextName) { - if (!scn.isJar()) { - scn.processClasses(this, packageName, h, contextName); - } else { - scn.processZipContent(packageName, this, h, contextName); } } @@ -408,7 +397,20 @@ /* -------------- ScannerListener Implementierung --------------- */ @Override - public void annotationFound(Class foundClass, Handler h, String contextName) { - wire(h, foundClass, contextName); + public void annotationFound(Class foundClass, Object[] params) { + Handler h = null; + String contextName = null; + for(Object param : params) { + if(param instanceof Handler) { + h = (Handler) param; + } else if(param instanceof String) { + contextName = (String) param; + } + } + if(h == null || contextName == null) { + Logger.getLogger(Factory.class.getName()).log(Level.FINER, "Handler oder contextName ist null"); + } else { + wire(h, foundClass, contextName); + } } } \ No newline at end of file -- Gitblit v1.9.3