[jboss-svn-commits] JBoss Common SVN: r4474 - in jboss-logging/trunk/src/main/java/org/jboss/logging: annotation and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jun 8 12:49:55 EDT 2010


Author: david.lloyd at jboss.com
Date: 2010-06-08 12:49:53 -0400 (Tue, 08 Jun 2010)
New Revision: 4474

Added:
   jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/
   jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/LogMessage.java
   jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/Message.java
   jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/MessageBundle.java
   jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/MessageLogger.java
Modified:
   jboss-logging/trunk/src/main/java/org/jboss/logging/ParameterConverter.java
Log:
Move annotations in, unify this sucker

Modified: jboss-logging/trunk/src/main/java/org/jboss/logging/ParameterConverter.java
===================================================================
--- jboss-logging/trunk/src/main/java/org/jboss/logging/ParameterConverter.java	2010-06-07 15:19:43 UTC (rev 4473)
+++ jboss-logging/trunk/src/main/java/org/jboss/logging/ParameterConverter.java	2010-06-08 16:49:53 UTC (rev 4474)
@@ -35,7 +35,7 @@
     /**
      * Convert the parameter to its string or string-equivalent representation.  The returned value will be passed in
      * as a parameter to either a {@link java.text.MessageFormat} or {@link java.util.Formatter} instance, depending
-     * on the setting of {@link org.jboss.i18ntool.annotation.Message#format()}.
+     * on the setting of {@link org.jboss.logging.annotation.Message#format()}.
      *
      * @param locale the locale
      * @param parameter the parameter

Added: jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/LogMessage.java
===================================================================
--- jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/LogMessage.java	                        (rev 0)
+++ jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/LogMessage.java	2010-06-08 16:49:53 UTC (rev 4474)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.logging.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A typed logger method.  Indicates that this method will log the associated {@link Message} to the logger system, as
+ * opposed to being a simple message lookup.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.METHOD)
+public @interface LogMessage {
+
+    /**
+     * The log level at which this message should be logged.  Defaults to {@code INFO}.
+     *
+     * @return the log level
+     */
+    Level level() default Level.INFO;
+
+    enum Level {
+        TRACE,
+        DEBUG,
+        INFO,
+        WARN,
+        ERROR,
+        FATAL
+    }
+}

Added: jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/Message.java
===================================================================
--- jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/Message.java	                        (rev 0)
+++ jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/Message.java	2010-06-08 16:49:53 UTC (rev 4474)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.logging.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Assigns a message string to a resource method.  The method arguments are used to supply the positional parameter
+ * values for the method.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+ at Target(ElementType.METHOD)
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface Message {
+
+    /**
+     * Indicates that this message has no ID.
+     */
+    int NONE = 0;
+    /**
+     * Indicates that this message should inherit the ID from another message with the same name.
+     */
+    int INHERIT = -1;
+
+    /**
+     * The message ID number.  Only one message with a given name may specify an ID other than {@link #INHERIT}.
+     *
+     * @return the message ID number
+     */
+    int id() default INHERIT;
+
+    /**
+     * The default format string of this message.
+     *
+     * @return the format string
+     */
+    String value();
+
+    /**
+     * The format type of this method (defaults to {@link Format#PRINTF}).
+     *
+     * @return the format type
+     */
+    Format format() default Format.PRINTF;
+
+    /**
+     * The converter to use.  Any specified converter must implement the {@code ParameterConverter} interface
+     * from JBoss Logging or JBoss I18n.
+     *
+     * @return the converter
+     */
+    Class<?> converter() default Object.class;
+
+    /**
+     * The possible format types.
+     */
+    enum Format {
+
+        /**
+         * A {@link java.util.Formatter}-type format string.
+         */
+        PRINTF,
+        /**
+         * A {@link java.text.MessageFormat}-type format string.
+         */
+        MESSAGE_FORMAT,
+    }
+
+}

Added: jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/MessageBundle.java
===================================================================
--- jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/MessageBundle.java	                        (rev 0)
+++ jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/MessageBundle.java	2010-06-08 16:49:53 UTC (rev 4474)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.logging.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Signify that an interface is a message bundle interface.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+ at Target(ElementType.TYPE)
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface MessageBundle {
+
+    /**
+     * Get the project code for messages that have an associated code.
+     *
+     * @return the project code
+     */
+    String projectCode() default "";
+}

Added: jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/MessageLogger.java
===================================================================
--- jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/MessageLogger.java	                        (rev 0)
+++ jboss-logging/trunk/src/main/java/org/jboss/logging/annotation/MessageLogger.java	2010-06-08 16:49:53 UTC (rev 4474)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.logging.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Signify that an interface is a typed logger interface.  A message logger interface may optionally extend other message logger
+ * interfaces and message bundle interfaces (see {@link MessageBundle}, as well as the {@link org.jboss.logging.BasicLogger} interface.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
+public @interface MessageLogger {
+
+    /**
+     * Get the project code for messages that have an associated code.
+     *
+     * @return the project code
+     */
+    String projectCode() default "";
+}



More information about the jboss-svn-commits mailing list