From cf5a0ec1cdeec3eb867cebc38f308bbf5ad73468 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 26 Nov 2013 16:26:35 +0000
Subject: [PATCH] Horrible workaround for invalid Javadoc generation.

---
 opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java |   89 ++++++++++++++++++-----------
 opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java      |   32 ++++++++++
 2 files changed, 86 insertions(+), 35 deletions(-)

diff --git a/opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java b/opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java
index 59a54c4..1931e6a 100644
--- a/opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java
+++ b/opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java
@@ -27,7 +27,10 @@
 
 package org.forgerock.opendj.ldap.schema;
 
-import static com.forgerock.opendj.ldap.CoreMessages.*;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAME_FORM_STRUCTURAL_CLASS_NOT_STRUCTURAL1;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_OPTIONAL_ATTR1;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_REQUIRED_ATTR1;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_NAME_FORM_UNKNOWN_STRUCTURAL_CLASS1;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -37,6 +40,7 @@
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -97,6 +101,21 @@
             return this.getSchemaBuilder().addNameForm(new NameForm(this), false);
         }
 
+        @Override
+        public Builder description(final String description) {
+            return description0(description);
+        }
+
+        @Override
+        public Builder extraProperties(final Map<String, List<String>> extraProperties) {
+            return extraProperties0(extraProperties);
+        }
+
+        @Override
+        public Builder extraProperties(final String extensionName, final String... extensionValues) {
+            return extraProperties0(extensionName, extensionValues);
+        }
+
         /**
          * Adds the provided user friendly names.
          *
@@ -168,6 +187,11 @@
             return optionalAttributes(Arrays.asList(nameOrOIDs));
         }
 
+        @Override
+        public Builder removeAllExtraProperties() {
+            return removeAllExtraProperties0();
+        }
+
         /**
          * Removes all user friendly names.
          *
@@ -198,6 +222,12 @@
             return this;
         }
 
+        @Override
+        public Builder removeExtraProperty(final String extensionName,
+                final String... extensionValues) {
+            return removeExtraProperty0(extensionName, extensionValues);
+        }
+
         /**
          * Removes the provided user friendly name.
          *
diff --git a/opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java b/opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java
index bbc470e..814389e 100644
--- a/opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java
+++ b/opendj3/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java
@@ -65,6 +65,15 @@
             this.extraProperties = new LinkedHashMap<String, List<String>>(copy.extraProperties);
         }
 
+        /*
+         * The abstract methods in this class are required in order to obtain
+         * meaningful Javadoc. If the methods were defined in this class then
+         * the resulting Javadoc in sub-class is invalid. The only workaround is
+         * to make the methods abstract, provide "xxx0" implementations, and
+         * override the abstract methods in sub-classes as delegates to the
+         * "xxx0" methods. Ghastly! Thanks Javadoc.
+         */
+
         /**
          * Sets the description.
          *
@@ -73,10 +82,7 @@
          *            the empty string will be used.
          * @return This builder.
          */
-        public T description(final String description) {
-            this.description = description == null ? "" : description;
-            return getThis();
-        }
+        public abstract T description(final String description);
 
         /**
          * Adds the provided collection of extended properties.
@@ -85,10 +91,7 @@
          *            The collection of extended properties.
          * @return This builder.
          */
-        public T extraProperties(final Map<String, List<String>> extraProperties) {
-            this.extraProperties.putAll(extraProperties);
-            return getThis();
-        }
+        public abstract T extraProperties(final Map<String, List<String>> extraProperties);
 
         /**
          * Adds the provided extended property.
@@ -99,27 +102,15 @@
          *            The optional list of values for the extended property.
          * @return This builder.
          */
-        public T extraProperties(final String extensionName, final String... extensionValues) {
-            if (this.extraProperties.get(extensionName) != null) {
-                final List<String> tempExtraProperties =
-                        new ArrayList<String>(this.extraProperties.get(extensionName));
-                tempExtraProperties.addAll(Arrays.asList(extensionValues));
-                this.extraProperties.put(extensionName, tempExtraProperties);
-            } else {
-                this.extraProperties.put(extensionName, Arrays.asList(extensionValues));
-            }
-            return getThis();
-        }
+        public abstract T extraProperties(final String extensionName,
+                final String... extensionValues);
 
         /**
          * Removes all extra properties.
          *
          * @return This builder.
          */
-        public T removeAllExtraProperties() {
-            this.extraProperties.clear();
-            return getThis();
-        }
+        public abstract T removeAllExtraProperties();
 
         /**
          * Removes the specified extended property.
@@ -132,23 +123,36 @@
          *            should be removed.
          * @return This builder.
          */
-        public T removeExtraProperty(final String extensionName, final String... extensionValues) {
-            if (this.extraProperties.get(extensionName) != null && extensionValues.length > 0) {
-                final List<String> tempExtraProperties =
-                        new ArrayList<String>(this.extraProperties.get(extensionName));
-                tempExtraProperties.removeAll(Arrays.asList(extensionValues));
-                this.extraProperties.put(extensionName, tempExtraProperties);
-            } else if (this.extraProperties.get(extensionName) != null) {
-                this.extraProperties.remove(extensionName);
-            }
-            return getThis();
-        }
+        public abstract T removeExtraProperty(final String extensionName,
+                final String... extensionValues);
 
         T definition(final String definition) {
             this.definition = definition;
             return getThis();
         }
 
+        T description0(final String description) {
+            this.description = description == null ? "" : description;
+            return getThis();
+        }
+
+        T extraProperties0(final Map<String, List<String>> extraProperties) {
+            this.extraProperties.putAll(extraProperties);
+            return getThis();
+        }
+
+        T extraProperties0(final String extensionName, final String... extensionValues) {
+            if (this.extraProperties.get(extensionName) != null) {
+                final List<String> tempExtraProperties =
+                        new ArrayList<String>(this.extraProperties.get(extensionName));
+                tempExtraProperties.addAll(Arrays.asList(extensionValues));
+                this.extraProperties.put(extensionName, tempExtraProperties);
+            } else {
+                this.extraProperties.put(extensionName, Arrays.asList(extensionValues));
+            }
+            return getThis();
+        }
+
         String getDescription() {
             return description;
         }
@@ -162,6 +166,23 @@
         }
 
         abstract T getThis();
+
+        T removeAllExtraProperties0() {
+            this.extraProperties.clear();
+            return getThis();
+        }
+
+        T removeExtraProperty0(final String extensionName, final String... extensionValues) {
+            if (this.extraProperties.get(extensionName) != null && extensionValues.length > 0) {
+                final List<String> tempExtraProperties =
+                        new ArrayList<String>(this.extraProperties.get(extensionName));
+                tempExtraProperties.removeAll(Arrays.asList(extensionValues));
+                this.extraProperties.put(extensionName, tempExtraProperties);
+            } else if (this.extraProperties.get(extensionName) != null) {
+                this.extraProperties.remove(extensionName);
+            }
+            return getThis();
+        }
     }
 
     /**

--
Gitblit v1.10.0