cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r280337 - in /cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common: PreferenceImpl.java PreferenceSetImpl.java
Date Mon, 12 Sep 2005 13:04:08 GMT
Author: cziegeler
Date: Mon Sep 12 06:04:04 2005
New Revision: 280337

URL: http://svn.apache.org/viewcvs?rev=280337&view=rev
Log:
Cleanup

Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java?rev=280337&r1=280336&r2=280337&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java
Mon Sep 12 06:04:04 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
- * 
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@
  *
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * 
- * @version CVS $Id$
+ * @version $Id$
  */
 public class PreferenceImpl implements Preference, PreferenceCtrl, java.io.Serializable {
     
@@ -45,12 +45,16 @@
         // nothing to do 
     }
 
-    // Preference implementation.
-
+    /**
+     * @see org.apache.pluto.om.common.Preference#getName()
+     */
     public String getName() {
         return name;
     }
 
+    /**
+     * @see org.apache.pluto.om.common.Preference#getValues()
+     */
     public Iterator getValues() {
         // replace the NULL_VALUE String by NULL
         if (value.contains(NULL_VALUE)) {
@@ -70,6 +74,9 @@
         return returnValue.iterator();
     }
 
+    /**
+     * @see org.apache.pluto.om.common.Preference#isReadOnly()
+     */
     public boolean isReadOnly() {
         if (readOnly == null) {
             return false;
@@ -77,16 +84,25 @@
         return readOnly.booleanValue();
     }
 
+    /**
+     * @see org.apache.pluto.om.common.Preference#isValueSet()
+     */
     public boolean isValueSet() {
         return value != null;
     }
 
     // PreferenceCtrl implementation.
     
+    /**
+     * @see org.apache.pluto.om.common.PreferenceCtrl#setName(java.lang.String)
+     */
     public void setName(String name) {
         this.name = name;
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceCtrl#setValues(java.util.List)
+     */
     public void setValues(java.util.List _value) {
         if (this.value == null) {
             this.value = new ArrayList();
@@ -114,6 +130,9 @@
         this.value.addAll(addValue);
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceCtrl#setReadOnly(java.lang.String)
+     */
     public void setReadOnly(String readOnly) {
         this.readOnly = BooleanUtils.toBooleanObject(readOnly);
     }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java?rev=280337&r1=280336&r2=280337&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java
Mon Sep 12 06:04:04 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
- * 
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@
  *
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * 
- * @version CVS $Id$
+ * @version $Id$
  */
 public class PreferenceSetImpl
 implements PreferenceSet, PreferenceSetCtrl, java.io.Serializable {
@@ -42,8 +42,9 @@
     private ClassLoader classLoader;
     private Set preferences = new HashSet();
 
-    // PreferenceSet implementation.
-
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSet#get(java.lang.String)
+     */
     public Preference get(String name) {
         Iterator iterator = this.preferences.iterator();
         while (iterator.hasNext()) {
@@ -55,10 +56,16 @@
         return null;
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSet#iterator()
+     */
     public Iterator iterator() {
         return this.preferences.iterator();
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSet#getPreferencesValidator()
+     */
     public PreferencesValidator getPreferencesValidator() {
         if (this.classLoader == null)
             throw new IllegalStateException("Portlet class loader not yet available to load
preferences validator.");
@@ -68,8 +75,9 @@
 
         try {
             Object validator = classLoader.loadClass(castorPreferencesValidator).newInstance();
-            if (validator instanceof PreferencesValidator)
-                return(PreferencesValidator)validator;
+            if (validator instanceof PreferencesValidator) {
+                return (PreferencesValidator)validator;
+            }
         } catch (Exception ignore) {
             // ignore it
         }
@@ -77,8 +85,9 @@
         return null;
     }
 
-    // PreferenceSetCtrl implementation.
-
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSetCtrl#add(java.lang.String, java.util.List)
+     */
     public Preference add(String name, List values) {
         PreferenceImpl preference = new PreferenceImpl();
         preference.setName(name);
@@ -93,7 +102,9 @@
         return this.preferences.add(preference);
     }
 
-
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSetCtrl#remove(java.lang.String)
+     */
     public Preference remove(String name) {
         Iterator iterator = this.iterator();
         while (iterator.hasNext()) {
@@ -106,24 +117,24 @@
         return null;
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSetCtrl#remove(org.apache.pluto.om.common.Preference)
+     */
     public void remove(Preference preference) {
         this.preferences.remove(preference);
     }
 
-    // additional methods.
-    
+    /**
+     * @see java.lang.Object#toString()
+     */
     public String toString() {
-        return toString(0);
-    }
-
-    public String toString(int indent) {
         StringBuffer buffer = new StringBuffer(50);
-        StringUtils.newLine(buffer,indent);
+        buffer.append(StringUtils.lineSeparator);
         buffer.append(getClass().toString());
         buffer.append(": ");
         Iterator iterator = this.iterator();
         while (iterator.hasNext()) {
-            buffer.append(((PreferenceImpl)iterator.next()).toString(indent+2));
+            buffer.append(((PreferenceImpl)iterator.next()).toString(2));
         }
         return buffer.toString();
     }
@@ -148,17 +159,19 @@
     }
 
     /**
+     * Makes a deep copy.
      * @see java.util.Collection#addAll(Collection)
-     * makes a deep copy
      */
     public boolean addAll(Collection c) {
+        boolean changed = false;
         Iterator it = c.iterator();
         while (it.hasNext()) {
+            changed = true;
             PreferenceImpl pref = (PreferenceImpl) it.next();
             this.add(pref.getName(), pref.getClonedCastorValuesAsList());
         }
 
-        return true;  //always assume something changed
+        return changed;
     }
 
 }



Mime
View raw message