You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/04/17 10:51:27 UTC

svn commit: r765910 - /camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java

Author: davsclaus
Date: Fri Apr 17 08:51:27 2009
New Revision: 765910

URL: http://svn.apache.org/viewvc?rev=765910&view=rev
Log:
CAMEL-1528: added id back as its useable for the JMX console overview

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java?rev=765910&r1=765909&r2=765910&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java Fri Apr 17 08:51:27 2009
@@ -44,6 +44,8 @@
     @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
     @XmlID
     private String id;
+    @XmlTransient
+    private boolean customId;
     @XmlElement(required = false)
     private DescriptionDefinition description;
 
@@ -60,6 +62,7 @@
      */
     public void setId(String value) {
         this.id = value;
+        customId = true;
     }
 
     public DescriptionDefinition getDescription() {
@@ -111,15 +114,34 @@
     }
 
     /**
+     * Sets the id of this node
+     *
+     * @param id  the id
+     * @return the builder
+     */
+    @SuppressWarnings("unchecked")
+    public T id(String id) {
+        setId(id);
+        return (T) this;
+    }
+
+    /**
      * Gets the node id, creating one if not already set.
      */
     public String idOrCreate() {
         if (id == null) {
-            setId(createId());
+            id = createId();
         }
         return getId();
     }
 
+    /**
+     * Returns whether a custom id has been assigned
+     */
+    public boolean hasCustomIdAssigned() {
+        return customId;
+    }
+
     // Implementation methods
     // -------------------------------------------------------------------------