[jboss-svn-commits] JBL Code SVN: r22405 - in labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb: annotation and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 4 11:18:17 EDT 2008
Author: beve
Date: 2008-09-04 11:18:17 -0400 (Thu, 04 Sep 2008)
New Revision: 22405
Added:
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/AnnotationConstants.java
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/ConfigParam.java
Log:
added annotations.
Added: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/AnnotationConstants.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/AnnotationConstants.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/AnnotationConstants.java 2008-09-04 15:18:17 UTC (rev 22405)
@@ -0,0 +1,19 @@
+package org.jboss.esb.annotation;
+
+/**
+* Annotation constants.
+*
+* @author <a href="mailto:tom.fennelly at gmail.com">tom.fennelly at gmail.com</a>
+*/
+public abstract class AnnotationConstants {
+
+ /**
+ * "null" default annotation value.
+ */
+ public static final String NULL_STRING = "##NULL";
+
+ /**
+ * Unassigned default.
+ */
+ public static final String UNASSIGNED = "org.jboss.esb.annotation.AnnotationConstants##UNASSIGNED";
+}
Added: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/ConfigParam.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/ConfigParam.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/annotation/ConfigParam.java 2008-09-04 15:18:17 UTC (rev 22405)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * 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.esb.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.log4j.spi.Configurator;
+
+/**
+ * Configuration paramater field annotation.
+ * <p/>
+ *
+ * <h3>Usage</h3>
+ * Where the paramater name is the same as the field name:
+ * <pre>{@code
+ * @ConfigParam(decoder={@link org.milyn.javabean.decoders.IntegerDecoder}.class)
+ * private int maxDigits;
+ * </pre>}
+ * Where the paramater name is NOT the same as the field name:
+ * <pre>{@code
+ * @ConfigParam(name="max-digits", decoder={@link org.milyn.javabean.decoders.IntegerDecoder}.class)
+ * private int maxDigits;
+ * </pre>}
+ *
+ * @author <a href="mailto:tom.fennelly at gmail.com">tom.fennelly at gmail.com</a>
+ * @see Configurator
+ */
+ at Documented
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.FIELD, ElementType.METHOD})
+public @interface ConfigParam {
+
+ /**
+ * The paramater name as defined in the resource configuration. If not defined,
+ * the name defaults to the name of the field.
+ * @return The paramater name.
+ */
+ public String name() default AnnotationConstants.NULL_STRING;
+
+ /**
+ * Paramater required or optional.
+ * <p/>
+ * Defaults to required.
+ *
+ * @return Paramater usage.
+ */
+ public Use use() default Use.REQUIRED;
+
+ /**
+ * The default paramater value.
+ * <p/>
+ * Only relevant when use=OPTIONAL and the paramater is not defined on the configuration..
+ *
+ * @return The default paramater value (un-decoded).
+ */
+ public String defaultVal() default AnnotationConstants.UNASSIGNED;
+
+ /**
+ * Paramater choice values.
+ *
+ * @return List of valid choices (un-decoded).
+ */
+ public String[] choice() default AnnotationConstants.NULL_STRING;
+
+ /**
+ * Configuration paramater use.
+ */
+ public static enum Use {
+ /**
+ * Parameter is required.
+ */
+ REQUIRED,
+
+ /**
+ * Parameter is optional.
+ */
+ OPTIONAL,
+ }
+}
+
More information about the jboss-svn-commits
mailing list