]> git.mxchange.org Git - jcore-logger-ejb.git/commitdiff
Added annotation @Log for type-safety, according to website
authorRoland Haeder <roland@mxchange.org>
Tue, 8 Sep 2015 22:09:23 +0000 (00:09 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 8 Sep 2015 22:09:23 +0000 (00:09 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/java/org/mxchange/jcoreeelogger/Log.java [new file with mode: 0644]
src/java/org/mxchange/jcoreeelogger/LoggerFactory.java
src/java/org/mxchange/jcoreeelogger/beans/local/logger/LoggerBean.java

diff --git a/src/java/org/mxchange/jcoreeelogger/Log.java b/src/java/org/mxchange/jcoreeelogger/Log.java
new file mode 100644 (file)
index 0000000..4f2a82c
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 KLC
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcoreeelogger;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.inject.Qualifier;
+
+/**
+ * Logger annotation. This file has been taken from
+ * http://memorynotfound.com/java-se-unit-testing-cdi-junit-jboss-weld-se/ and has been slightly modified to make
+ * it compile
+ *
+ * @author Roland Haeder
+ */
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE, })
+public @interface Log {
+}
index a50873fc78f75abb3584b408ffd690db931bb098..b9858b3cc7ec5891105be1cbd71bd1a9b0d881a9 100644 (file)
@@ -36,6 +36,7 @@ public class LoggerFactory {
        }
 
        @Produces
+       @Log
        public Logger getLogger (final InjectionPoint caller) {
                return LogManager.getLogger(caller.getMember().getDeclaringClass().getName());
        }
index 2ca017d733ea0692f0a1f3fce2a03518764b6a8e..b1f0538958082c246b46fe0b4ed0dc9998882fd1 100644 (file)
@@ -20,6 +20,7 @@ import javax.ejb.Singleton;
 import javax.ejb.Startup;
 import javax.inject.Inject;
 import org.apache.logging.log4j.Logger;
+import org.mxchange.jcoreeelogger.Log;
 
 /**
  * A "centralized" logger bean
@@ -34,6 +35,7 @@ public class LoggerBean implements LoggerBeanLocal {
         * Logger instance
         */
        @Inject
+       @Log
        private Logger logger;
 
        @Override