abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1201407 - in /abdera/abdera2: activities/src/main/java/org/apache/abdera2/activities/model/objects/ common/src/main/java/org/apache/abdera2/common/geo/ common/src/main/java/org/apache/abdera2/common/http/ common/src/main/java/org/apache/ab...
Date Sun, 13 Nov 2011 06:16:55 GMT
Author: jmsnell
Date: Sun Nov 13 06:16:54 2011
New Revision: 1201407

URL: http://svn.apache.org/viewvc?rev=1201407&view=rev
Log: (empty)

Modified:
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/ServiceObject.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Line.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Authentication.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Preference.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/WebLink.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Range.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Subtag.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/SubtagSet.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Chain.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MapRed.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MoreFunctions.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/MapChannelManager.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/SimplePusher.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/UrlEncoding.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/activities/ActivityToFeedConverter.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/bidi/BidiHelper.java
    abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/features/Feature.java

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/ServiceObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/ServiceObject.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/ServiceObject.java (original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/ServiceObject.java Sun Nov 13 06:16:54 2011
@@ -45,11 +45,11 @@ public class ServiceObject 
     }
   }
   
-  protected ServiceObject(Map<String,Object> map) {
+  public ServiceObject(Map<String,Object> map) {
     super(map,Builder.class,ServiceObject.class);
   }
   
-  protected <X extends ServiceObject, M extends ASObject.Builder<X,M>>ServiceObject(Map<String,Object> map, Class<M> _class, Class<X> _obj) {
+  public <X extends ServiceObject, M extends ASObject.Builder<X,M>>ServiceObject(Map<String,Object> map, Class<M> _class, Class<X> _obj) {
     super(map,_class,_obj);
   }
 

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Line.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Line.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Line.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Line.java Sun Nov 13 06:16:54 2011
@@ -84,9 +84,7 @@ public class Line extends Multiple {
   
     public static class Builder extends Multiple.Builder<Line> {
       
-      public Builder() {
-        noDuplicates();
-      }
+      public Builder() {}
       
       public Line get() {
         return new Line(this);

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java Sun Nov 13 06:16:54 2011
@@ -20,26 +20,29 @@ package org.apache.abdera2.common.geo;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Set;
 
 import org.apache.abdera2.common.misc.MoreFunctions;
 
+import com.google.common.collect.ImmutableCollection;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import static com.google.common.base.Preconditions.*;
 @SuppressWarnings("unchecked")
-public abstract class Multiple extends Position implements Iterable<Coordinate> {
+public abstract class Multiple 
+  extends Position 
+  implements Iterable<Coordinate> {
   
-  public static abstract class Builder<X extends Multiple> extends Position.Builder<X> {
+  public static abstract class Builder<X extends Multiple> 
+    extends Position.Builder<X> {
 
-    protected Collection<Coordinate> coordinates = 
-      new ArrayList<Coordinate>();
+    protected ImmutableCollection.Builder<Coordinate> coordinates = 
+      ImmutableList.builder();
+    private int size = 0;
     protected int maxpoints = -1;
     
     public <P extends Builder<X>>P noDuplicates() {
-      this.coordinates = new LinkedHashSet<Coordinate>(coordinates);
+      this.coordinates = ImmutableSet.<Coordinate>builder().addAll(coordinates.build());
       return (P)this;
     }
     
@@ -50,31 +53,35 @@ public abstract class Multiple extends P
     public <P extends Builder<X>>P maximumCoordinates(int max) {
       checkArgument(max > -1, "Maximum must not be negative");
       this.maxpoints = max;
-      checkMaxPoints(coordinates.size(),max);
+      checkMaxPoints(size,max);
       return (P)this;
     }
     
     public <P extends Builder<X>>P add(Coordinate coordinate) {
-      checkMaxPoints(coordinates.size()+1,maxpoints);
+      checkMaxPoints(size+1,maxpoints);
       this.coordinates.add(coordinate);
+      size++;
       return (P)this;
     }
     
     public <P extends Builder<X>>P add(double latitude, double longitude) {
-      checkMaxPoints(coordinates.size()+1,maxpoints);
+      checkMaxPoints(size+1,maxpoints);
       this.coordinates.add(Coordinate.at(latitude,longitude));
+      size++;
       return (P)this;
     }
     
     public <P extends Builder<X>>P add(String position) {
-      checkMaxPoints(coordinates.size()+1,maxpoints);
+      checkMaxPoints(size+1,maxpoints);
       this.coordinates.add(Coordinate.at(position));
+      size++;
       return (P)this;
     }
     
     public <P extends Builder<X>>P add(IsoPosition position) {
-      checkMaxPoints(coordinates.size()+1,maxpoints);
+      checkMaxPoints(size+1,maxpoints);
       this.coordinates.add(Coordinate.at(position));
+      size++;
       return (P)this;
     }
     
@@ -85,10 +92,7 @@ public abstract class Multiple extends P
 
     protected Multiple(Builder<?> builder) {
       super(builder);
-      this.coordinates = 
-        builder.coordinates instanceof Set ?
-          ImmutableSet.<Coordinate>copyOf(builder.coordinates) :
-        ImmutableList.<Coordinate>copyOf(builder.coordinates);
+      this.coordinates = builder.coordinates.build();
     }
 
     public Iterator<Coordinate> iterator() {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Authentication.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Authentication.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Authentication.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Authentication.java Sun Nov 13 06:16:54 2011
@@ -21,12 +21,9 @@ import java.io.ByteArrayOutputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
-import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -44,8 +41,9 @@ import org.apache.commons.codec.binary.S
 
 import com.google.common.base.Function;
 import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterators;
+import com.google.common.collect.Sets;
 
 /**
  * Implementation of the HTTP Challenge/Credentials Construct. This is helpful when 
@@ -71,18 +69,16 @@ public class Authentication implements I
     Pattern.compile("("+PARAM+")");
   
   private final static Set<String> ALWAYS = 
-    new HashSet<String>(
-      ImmutableSet.of(
-        "domain",
-        "nonce",
-        "opaque",
-        "qop",
-        "realm"));
+    Sets.newHashSet(
+      "domain",
+      "nonce",
+      "opaque",
+      "qop",
+      "realm");
   
   public static synchronized void alwaysQuote(String... names) {
-    checkNotNull(names);
     checkArgument(names.length > 0);
-    for (String name : names)
+    for (String name : checkNotNull(names))
       ALWAYS.add(name);
   }
   
@@ -125,12 +121,12 @@ public class Authentication implements I
 
   public static class Builder 
     implements Supplier<Authentication> {
-    private String scheme;
-    private String b64token;
-    private final Map<String,String> params = 
-      new LinkedHashMap<String,String>();
-    private final Set<String> quoted = 
-      new HashSet<String>();
+    String scheme;
+    String b64token;
+    final ImmutableMap.Builder<String,String> params = 
+      ImmutableMap.builder();
+    final ImmutableSet.Builder<String> quoted = 
+      ImmutableSet.builder();
     
     public Authentication get() {
       checkNotNull(scheme);
@@ -172,9 +168,8 @@ public class Authentication implements I
   
   private final String scheme;
   private final String b64token;
-  private final Map<String,String> params = 
-    new LinkedHashMap<String,String>();
-  private final Set<String> quoted;
+  private final ImmutableMap<String,String> params;
+  private final ImmutableSet<String> quoted;
     
   public Authentication(String scheme) {
     this(scheme,null);
@@ -184,14 +179,15 @@ public class Authentication implements I
     checkNotNull(scheme);
     this.scheme = scheme.toLowerCase(Locale.US);
     this.b64token = b64token;
+    this.params = ImmutableMap.<String,String>of();
     this.quoted = ImmutableSet.<String>of();
   }
   
-  private Authentication(Builder builder) {
+  Authentication(Builder builder) {
     this.scheme = builder.scheme;
     this.b64token = builder.b64token;
-    this.params.putAll(builder.params);
-    this.quoted = ImmutableSet.copyOf(builder.quoted);
+    this.params = builder.params.build();
+    this.quoted = builder.quoted.build();
   }
   
   public String getScheme() {
@@ -215,7 +211,7 @@ public class Authentication implements I
   }
   
   public Iterator<String> iterator() {
-    return Iterators.unmodifiableIterator(params.keySet().iterator());
+    return params.keySet().iterator();
   }
   
   private boolean isquoted(String param) {
@@ -249,7 +245,7 @@ public class Authentication implements I
 
   @Override
   public int hashCode() {
-    return MoreFunctions.genHashCode(1,b64token,params,scheme);
+    return MoreFunctions.genHashCode(1,b64token,params,scheme.toLowerCase());
   }
 
   @Override
@@ -274,7 +270,7 @@ public class Authentication implements I
     if (scheme == null) {
       if (other.scheme != null)
         return false;
-    } else if (!scheme.equals(other.scheme))
+    } else if (!scheme.equalsIgnoreCase(other.scheme))
       return false;
     return true;
   }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java Sun Nov 13 06:16:54 2011
@@ -18,7 +18,6 @@
 package org.apache.abdera2.common.http;
 
 import java.io.Serializable;
-import java.util.LinkedHashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
@@ -27,6 +26,7 @@ import org.apache.abdera2.common.misc.Mo
 
 import com.google.common.base.Function;
 import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -34,7 +34,7 @@ import static com.google.common.base.Pre
 
 public final class CacheControl implements Serializable {
 
-  private static final Set<String> reserved = 
+  static final Set<String> reserved = 
     ImmutableSet.of(
       "private","public","no-cache","no-store","no-transform","only-if-cached",
       "must-revalidate", "proxy-revalidate", "max-age", "max-stale", "min-fresh",
@@ -60,8 +60,8 @@ public final class CacheControl implemen
                    smax_age = -1,
                    staleiferror = -1,
                    stalewhilerevalidate = -1;
-    protected final Map<String,Object> exts =
-      new LinkedHashMap<String,Object>();
+    protected final ImmutableMap.Builder<String,Object> exts =
+      ImmutableMap.builder();
     
     public Builder() {
       defaults();
@@ -290,10 +290,9 @@ public final class CacheControl implemen
                  smax_age,
                  staleiferror,
                  stalewhilerevalidate;
-  protected final Map<String,Object> exts =
-    new LinkedHashMap<String,Object>();
+  protected final ImmutableMap<String,Object> exts;
   
-  private CacheControl(Builder builder) {
+  CacheControl(Builder builder) {
     this.flags = builder.flags;
     this.nocache_headers = 
       builder.nocache_headers != null ?
@@ -309,7 +308,7 @@ public final class CacheControl implemen
     this.smax_age = builder.smax_age;
     this.staleiferror = builder.staleiferror;
     this.stalewhilerevalidate = builder.stalewhilerevalidate;
-    this.exts.putAll(builder.exts);
+    this.exts = builder.exts.build();
   }
   
   public Object getExtension(String name) {
@@ -317,7 +316,7 @@ public final class CacheControl implemen
   }
   
   public Iterable<String> listExtensions() {
-    return Iterables.unmodifiableIterable(exts.keySet());
+    return exts.keySet();
   }
   
   protected boolean check(int flag) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java Sun Nov 13 06:16:54 2011
@@ -36,7 +36,7 @@ public final class CacheControlUtil {
 
     private CacheControlUtil() {}
   
-    private static long value(String val) {
+    static long value(String val) {
         return (val != null) ? Long.parseLong(val) : -1;
     }
     

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Preference.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Preference.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Preference.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/Preference.java Sun Nov 13 06:16:54 2011
@@ -19,12 +19,7 @@ package org.apache.abdera2.common.http;
 
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
@@ -41,7 +36,9 @@ import org.apache.abdera2.common.text.Ch
 import static com.google.common.base.Preconditions.*;
 
 import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
 
 /**
  * Implementation of the Prefer HTTP Header, e.g.
@@ -96,10 +93,10 @@ public class Preference implements Seria
   
   public static class Builder implements Supplier<Preference> {
 
-    private String token;
-    private String value;
-    private final Map<String,String> params = 
-      new LinkedHashMap<String,String>();
+    String token;
+    String value;
+    final ImmutableMap.Builder<String,String> params = 
+      ImmutableMap.builder();
     
     public Preference get() {
       return new Preference(this);
@@ -166,13 +163,12 @@ public class Preference implements Seria
   private static final long serialVersionUID = -6238673046322517740L;
   private final String token;
   private final String value;
-  private final Map<String,String> params = 
-    new HashMap<String,String>();
+  private final ImmutableMap<String,String> params;
   
-  private Preference(Builder builder) {
+  Preference(Builder builder) {
     this.token = builder.token;
     this.value = builder.value;
-    this.params.putAll(builder.params);
+    this.params = builder.params.build();
   }
   
   public Preference(String token) {
@@ -183,6 +179,7 @@ public class Preference implements Seria
     Profile.TOKEN.verify(token);
     this.token = token.toLowerCase(Locale.US);
     this.value = value;
+    this.params = ImmutableMap.<String,String>of();
   }
   
   public String getToken() {
@@ -209,10 +206,10 @@ public class Preference implements Seria
     return Boolean.parseBoolean(value);
   }
   
-  private static final Set<String> reserved = 
-    new HashSet<String>(); // no reserved yet
+  static final Set<String> reserved = 
+    ImmutableSet.<String>of(); // no reserved yet
   
-  private static boolean reserved(String name) {
+  static boolean reserved(String name) {
     return reserved.contains(name);
   }
   
@@ -307,7 +304,7 @@ public class Preference implements Seria
     Pattern.compile("("+PARAM+")");
   
   public static Iterable<Preference> parse(String text) {
-    List<Preference> prefs = new ArrayList<Preference>();
+    ImmutableList.Builder<Preference> prefs = ImmutableList.builder();
     Matcher matcher = pattern.matcher(text);
     while (matcher.find()) {
       String pref = matcher.group(1);
@@ -333,7 +330,7 @@ public class Preference implements Seria
       }
       prefs.add(maker.get());
     }
-    return Iterables.unmodifiableIterable(prefs);
+    return prefs.build();
   }
   
   public static String toString(

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/WebLink.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/WebLink.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/WebLink.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/WebLink.java Sun Nov 13 06:16:54 2011
@@ -18,12 +18,7 @@
 package org.apache.abdera2.common.http;
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
@@ -39,6 +34,7 @@ import org.apache.abdera2.common.text.Co
 import com.google.common.base.Function;
 import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 
 import static org.apache.abdera2.common.text.CharUtils.*;
@@ -70,19 +66,19 @@ public class WebLink implements Serializ
   
   public static class Builder implements Supplier<WebLink> {
 
-    private IRI iri;
-    private final Set<String> rel = 
-      new LinkedHashSet<String>();
-    private IRI anchor;
-    private final Set<String> rev =
-      new LinkedHashSet<String>();
-    private Lang lang;
-    private final Set<String> media = 
-      new LinkedHashSet<String>();
-    private String title;
-    private MimeType mediaType;
-    private final Map<String,String> params = 
-      new LinkedHashMap<String,String>();
+    IRI iri;
+    final ImmutableSet.Builder<String> rel = 
+      ImmutableSet.builder();
+    IRI anchor;
+    final ImmutableSet.Builder<String> rev =
+     ImmutableSet.builder();
+    Lang lang;
+    final ImmutableSet.Builder<String> media = 
+      ImmutableSet.builder();
+    String title;
+    MimeType mediaType;
+    final ImmutableMap.Builder<String,String> params = 
+      ImmutableMap.builder();
 
     public Builder () {}
     
@@ -99,19 +95,15 @@ public class WebLink implements Serializ
       return this;
     }
     
-    public Builder from(WebLink link) {
+    Builder from(WebLink link) {
       this.iri = link.iri;
-      this.rel.clear();
       this.rel.addAll(link.rel);
       this.anchor = link.anchor;
-      this.rev.clear();
       this.rev.addAll(link.rev);
       this.lang = link.lang;
-      this.media.clear();
       this.media.addAll(link.media);
       this.title = link.title;
       this.mediaType = link.mediaType;
-      this.params.clear();
       this.params.putAll(link.params);
       return this;
     }
@@ -183,33 +175,26 @@ public class WebLink implements Serializ
     }
   }
   
-  private final IRI iri;
-  private final Set<String> rel;
-  private IRI anchor;
-  private final Set<String> rev;
-  private Lang lang;
-  private final Set<String> media;
-  private String title;
-  private MimeType mediaType;
-  private final Map<String,String> params = 
-    new LinkedHashMap<String,String>();
+  final IRI iri;
+  final Set<String> rel;
+  final IRI anchor;
+  final Set<String> rev;
+  final Lang lang;
+  final Set<String> media;
+  final String title;
+  final MimeType mediaType;
+  final ImmutableMap<String,String> params;
   
-  private WebLink(Builder builder) {
+  WebLink(Builder builder) {
     this.iri = builder.iri;
-    this.rel = builder.rel != null ?
-      ImmutableSet.copyOf(builder.rel) :
-      ImmutableSet.<String>of();
-    this.rev = builder.rev != null ?
-      ImmutableSet.copyOf(builder.rev) :
-      ImmutableSet.<String>of();
-    this.media = builder.media != null ?
-      ImmutableSet.copyOf(builder.media) :
-      ImmutableSet.<String>of();
+    this.rel = builder.rel.build();
+    this.rev = builder.rev.build();
+    this.media = builder.media.build();
     this.anchor = builder.anchor;
     this.lang = builder.lang;
     this.title = builder.title;
     this.mediaType = builder.mediaType;
-    this.params.putAll(builder.params);
+    this.params = builder.params.build();
   }
   
   public WebLink(String iri) {
@@ -232,6 +217,7 @@ public class WebLink implements Serializ
     this.lang = null;
     this.title = null;
     this.mediaType = null;
+    this.params = ImmutableMap.<String,String>of();
   }
   
   public WebLink(IRI iri) {
@@ -244,6 +230,7 @@ public class WebLink implements Serializ
     this.rel = ImmutableSet.<String>of();
     this.rev = ImmutableSet.<String>of();
     this.media = ImmutableSet.<String>of();
+    this.params = ImmutableMap.<String,String>of();
   }
   
   public IRI getResolvedIri(IRI base) {
@@ -358,11 +345,10 @@ public class WebLink implements Serializ
 
 
   private static final Set<String> reserved = 
-    new HashSet<String>(
-      ImmutableSet.of(
-        "rel","anchor","rev","hreflang",
-        "media","title","type"));
-  private static boolean reserved(String name) {
+    ImmutableSet.of(
+      "rel","anchor","rev","hreflang",
+      "media","title","type");
+  static boolean reserved(String name) {
     return reserved.contains(name);
   }
   
@@ -425,7 +411,7 @@ public class WebLink implements Serializ
   };
   
   public static Iterable<WebLink> parse(String text) {
-    List<WebLink> links = new ArrayList<WebLink>();
+    ImmutableList.Builder<WebLink> links = ImmutableList.builder();
     if (text == null) return ImmutableList.<WebLink>of();
     int z = scanFor('<', text, 0, true);
     while(z != -1) {
@@ -465,7 +451,7 @@ public class WebLink implements Serializ
       if (s == -1) break;
       z = scanFor('<', text, s+1, false);
     }
-    return ImmutableList.copyOf(links);
+    return links.build();
   }
     
   public static String toString(WebLink link, WebLink... links) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Lang.java Sun Nov 13 06:16:54 2011
@@ -17,9 +17,8 @@
  */
 package org.apache.abdera2.common.lang;
 
-import java.util.ArrayList;
+//import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -30,7 +29,7 @@ import static org.apache.abdera2.common.
 import static com.google.common.base.Preconditions.checkArgument;
 
 import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
+import com.google.common.collect.ImmutableList;
 
 /**
  * Implementation of RFC 4646 Language Tags. Instances are immutable and 
@@ -154,13 +153,13 @@ public final class Lang 
     }
     
     public Iterable<Subtag> extensions() {
-      List<Subtag> list = new ArrayList<Subtag>();
+      ImmutableList.Builder<Subtag> list = ImmutableList.builder();
       Subtag extension = extension();
       while(extension != null) {
         list.add(extension);
         extension = nextExtension(extension);
       }
-      return Iterables.unmodifiableIterable(list);
+      return list.build();
     }
     
     public Subtag extension(String name) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Range.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Range.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Range.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Range.java Sun Nov 13 06:16:54 2011
@@ -18,8 +18,6 @@
 package org.apache.abdera2.common.lang;
 
 import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -28,7 +26,7 @@ import org.apache.abdera2.common.lang.Su
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
+import com.google.common.collect.ImmutableList;
 
 import static org.apache.abdera2.common.text.CharUtils.*;
 import static com.google.common.base.Preconditions.*;
@@ -84,22 +82,21 @@ public final class Range 
         if (root.type() == Subtag.Type.WILDCARD) {
             return new Range("*");
         } else {
-            List<Subtag> list = new LinkedList<Subtag>();
-            for (Subtag tag : this) {
-                if (tag.type() != Subtag.Type.WILDCARD)
-                    list.add(new Subtag(tag.type(),tag.name(),null));
-            }
+            ImmutableList.Builder<Subtag> list = ImmutableList.builder();
+            for (Subtag tag : this)
+              if (tag.type() != Subtag.Type.WILDCARD)
+                list.add(new Subtag(tag.type(),tag.name(),null));
             Subtag primary = null, current = null;
-            for (Subtag tag : list) {
-                tag.setNext(null);
-                tag.setPrevious(null);
-                if (primary == null) {
-                    primary = tag;
-                    current = primary;
-                } else {
-                    current.setNext(tag);
-                    current = tag;
-                }
+            for (Subtag tag : list.build()) {
+              tag.setNext(null);
+              tag.setPrevious(null);
+              if (primary == null) {
+                primary = tag;
+                current = primary;
+              } else {
+                checkNotNull(current).setNext(tag);
+                current = tag;
+              }
             }
             return new Range(primary);
         }
@@ -231,19 +228,21 @@ public final class Range 
     }
     
     public Iterable<Lang> filter(Lang... lang) {
-        List<Lang> langs = new LinkedList<Lang>();
-        for (Lang l : lang)
-            if (matches(l))
-                langs.add(l);
-        return Iterables.unmodifiableIterable(langs);
+      ImmutableList.Builder<Lang> langs = 
+        ImmutableList.builder();
+      for (Lang l : lang)
+        if (matches(l))
+          langs.add(l);
+      return langs.build();
     }
 
     public Iterable<String> filter(String... lang) {
-        List<String> langs = new LinkedList<String>();
+      ImmutableList.Builder<String> langs = 
+        ImmutableList.builder();
         for (String l : lang)
-            if (matches(l))
-                langs.add(l);
-        return Iterables.unmodifiableIterable(langs);
+          if (matches(l))
+            langs.add(l);
+        return langs.build();
     }
 
     public static Iterable<Lang> filter(String range, Lang... lang) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Subtag.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Subtag.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Subtag.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/Subtag.java Sun Nov 13 06:16:54 2011
@@ -31,98 +31,102 @@ public final class Subtag 
 
     private static final long serialVersionUID = -4496128268514329138L;
 
+    static Type wild(String name, Type other) {
+      return name.equals("*") ? Type.WILDCARD : other;
+    }
+    
     public static Subtag language(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.LANGUAGE, name);
+      return new Subtag(wild(name,Type.LANGUAGE), name);
     }
     
     public static Subtag language(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.LANGUAGE, name, prev);
+      return new Subtag(wild(name,Type.LANGUAGE), name, prev);
     }
     
     public static Subtag extlang(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.EXTLANG, name);
+      return new Subtag(wild(name,Type.EXTLANG), name);
     }
     
     public static Subtag extlang(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.EXTLANG, name, prev);
+      return new Subtag(wild(name,Type.EXTLANG), name, prev);
     }
     
     public static Subtag script(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.SCRIPT, name);
+      return new Subtag(wild(name,Type.SCRIPT), name);
     }
     
     public static Subtag script(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.SCRIPT, name, prev);
+      return new Subtag(wild(name,Type.SCRIPT), name, prev);
     }
     
     public static Subtag region(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.REGION, name);
+      return new Subtag(wild(name,Type.REGION), name);
     }
     
     public static Subtag region(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.REGION, name, prev);
+      return new Subtag(wild(name,Type.REGION), name, prev);
     }
     
     public static Subtag variant(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.VARIANT, name);
+      return new Subtag(wild(name,Type.VARIANT), name);
     }
     
     public static Subtag variant(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.VARIANT, name, prev);
+      return new Subtag(wild(name,Type.VARIANT), name, prev);
     }
     
     public static Subtag singleton(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.SINGLETON, name);
+      return new Subtag(wild(name,Type.SINGLETON), name);
     }
     
     public static Subtag singleton(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.SINGLETON, name, prev);
+      return new Subtag(wild(name,Type.SINGLETON), name, prev);
     }
     
     public static Subtag extension(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.EXTENSION, name);
+      return new Subtag(wild(name,Type.EXTENSION), name);
     }
     
     public static Subtag extension(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.EXTENSION, name, prev);
+      return new Subtag(wild(name,Type.EXTENSION), name, prev);
     }
     
     public static Subtag privateuse(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.PRIVATEUSE, name);
+      return new Subtag(wild(name,Type.PRIVATEUSE), name);
     }
     
     public static Subtag privateuse(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.PRIVATEUSE, name, prev);
+      return new Subtag(wild(name,Type.PRIVATEUSE), name, prev);
     }
     
     public static Subtag grandfathered(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.GRANDFATHERED, name);
+      return new Subtag(wild(name,Type.GRANDFATHERED), name);
     }
     
     public static Subtag grandfathered(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.GRANDFATHERED, name, prev);
+      return new Subtag(wild(name,Type.GRANDFATHERED), name, prev);
     }
    
     public static Subtag simple(String name) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.SIMPLE, name);
+      return new Subtag(wild(name,Type.SIMPLE), name);
     }
     
     public static Subtag simple(String name, Subtag prev) {
-      return new Subtag(name.equals("*") ? Type.WILDCARD : Type.SIMPLE, name, prev);
+      return new Subtag(wild(name,Type.SIMPLE), name, prev);
     }
     
     public enum Type {
-        LANGUAGE,
-        EXTLANG,
-        SCRIPT,
-        REGION,
-        VARIANT,
-        SINGLETON,
-        EXTENSION,
-        PRIVATEUSE,
-        GRANDFATHERED,
-        WILDCARD,
-        SIMPLE
+      LANGUAGE,
+      EXTLANG,
+      SCRIPT,
+      REGION,
+      VARIANT,
+      SINGLETON,
+      EXTENSION,
+      PRIVATEUSE,
+      GRANDFATHERED,
+      WILDCARD,
+      SIMPLE
     }
 
     private final Type type;
@@ -132,34 +136,34 @@ public final class Subtag 
     private Subtag root;
 
     public Subtag(
-        Type type, 
-        String name) {
-        this(
-            type, 
-            name, 
-            null);
+      Type type, 
+      String name) {
+      this(
+        type, 
+        name, 
+        null);
     }
 
     Subtag() {
-        this(
-            Type.WILDCARD, 
-            "*");
+      this(
+        Type.WILDCARD, 
+        "*");
     }
 
     /**
      * Create a Subtag
      */
     public Subtag(
-        Type type, 
-        String name, 
-        Subtag prev) {
-        this.type = type;
-        this.name = name;
-        this.prev = prev;
-        if (prev != null) {
-            prev.setNext(this);
-            this.root = prev.root();
-        } else this.root = null;
+      Type type, 
+      String name, 
+      Subtag prev) {
+      this.type = type;
+      this.name = name;
+      this.prev = prev;
+      if (prev != null) {
+        prev.setNext(this);
+        this.root = prev.root();
+      } else this.root = null;
     }
 
     Subtag(Subtag copy, Subtag parent) {
@@ -167,16 +171,16 @@ public final class Subtag 
     }
     
     Subtag(
-        Type type, 
-        String name, 
-        Subtag prev, 
-        Subtag next,
-        Subtag root) {
-        this.type = type;
-        this.name = name;
-        this.prev = prev;
-        this.next = next;
-        this.root = root;
+      Type type, 
+      String name, 
+      Subtag prev, 
+      Subtag next,
+      Subtag root) {
+      this.type = type;
+      this.name = name;
+      this.prev = prev;
+      this.next = next;
+      this.root = root;
     }
 
     public Subtag root() {
@@ -210,24 +214,24 @@ public final class Subtag 
     }
 
     public String toString() {
-        switch (type) {
-            case LANGUAGE:
-                return name.toLowerCase(Locale.US);
-            case REGION:
-                return name.toUpperCase(Locale.US);
-            case SCRIPT:
-                return toTitleCase(name);
-            default:
-                return name.toLowerCase(Locale.US);
-        }
+      switch (type) {
+        case LANGUAGE:
+          return name.toLowerCase(Locale.US);
+        case REGION:
+          return name.toUpperCase(Locale.US);
+        case SCRIPT:
+          return toTitleCase(name);
+        default:
+          return name.toLowerCase(Locale.US);
+      }
     }
 
     private static String toTitleCase(String string) {
-        if (string == null || string.length() == 0)
-            return string;
-        char[] chars = string.toLowerCase(Locale.US).toCharArray();
-        chars[0] = Character.toTitleCase(chars[0]);
-        return new String(chars);
+      if (string == null || string.length() == 0)
+        return string;
+      char[] chars = string.toLowerCase(Locale.US).toCharArray();
+      chars[0] = Character.toTitleCase(chars[0]);
+      return new String(chars);
     }
 
     public int hashCode() {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/SubtagSet.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/SubtagSet.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/SubtagSet.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/lang/SubtagSet.java Sun Nov 13 06:16:54 2011
@@ -31,67 +31,67 @@ public abstract class SubtagSet 
              Comparable<SubtagSet>{
 
   private static final long serialVersionUID = -1862650860527311777L;
-    protected final Subtag root;
+  protected final Subtag root;
 
-    protected SubtagSet(Subtag root) {
-        this.root = root;
-    }
+  protected SubtagSet(Subtag root) {
+    this.root = root;
+  }
 
-    public String toString() {
-        StringBuilder buf = 
-          new StringBuilder();
-        Iterator<Subtag> tags = 
-          iterator();
-        buf.append(
-            tags.next().name());
-        while(tags.hasNext())
-            buf.append('-')
-               .append(tags.next().name());
-        return buf.toString();
-    }
+  public String toString() {
+    StringBuilder buf = 
+      new StringBuilder();
+    Iterator<Subtag> tags = 
+      iterator();
+    buf.append(
+      tags.next().name());
+    while(tags.hasNext())
+      buf.append('-')
+         .append(tags.next().name());
+    return buf.toString();
+  }
 
-    public Iterator<Subtag> iterator() {
-        return new SubtagIterator(root);
-    }
+  public Iterator<Subtag> iterator() {
+    return new SubtagIterator(root);
+  }
 
-    public boolean contains(Subtag subtag) {
-        for (Subtag tag : this)
-            if (tag.equals(subtag))
-                return true;
-        return false;
-    }
+  public boolean contains(Subtag subtag) {
+    for (Subtag tag : this)
+      if (tag.equals(subtag))
+        return true;
+    return false;
+  }
 
-    public boolean contains(String tag) {
-        return contains(tag, Subtag.Type.SIMPLE);
-    }
+  public boolean contains(String tag) {
+    return contains(tag, Subtag.Type.SIMPLE);
+  }
 
-    public boolean contains(String tag, Subtag.Type type) {
-        return contains(new Subtag(type, tag));
-    }
+  public boolean contains(String tag, Subtag.Type type) {
+    return contains(new Subtag(type, tag));
+  }
     
-    public int length() {
-        return toString().length();
-    }
+  public int length() {
+    return toString().length();
+  }
 
-    @SuppressWarnings("unused")
-    public int size() {
-        int n = 0;
-        for (Subtag tag : this)
-            n++;
-        return n;
-    }
+  @SuppressWarnings("unused")
+  public int size() {
+    int n = 0;
+    for (Subtag tag : this)
+      n++;
+    return n;
+  }
 
-    public Subtag get(int index) {
-        if (index < 0)
-            throw new IndexOutOfBoundsException();
-        if (index == 0) return root;
-        Subtag tag = root.next();
-        while (tag != null && --index > 0)
-          tag = tag.next();
-        if (tag == null)
-          throw new IndexOutOfBoundsException();
-        return tag;
-    }
+  public Subtag get(int index) {
+    if (index < 0)
+      throw new IndexOutOfBoundsException();
+    if (index == 0) return root;
+    Subtag tag = root.next();
+    while (tag != null && --index > 0)
+      tag = tag.next();
+    if (tag == null)
+      throw new IndexOutOfBoundsException();
+    return tag;
+  }
 
     public static class SubtagIterator implements Iterator<Subtag> {
         private Subtag current;

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/mediatype/MimeTypeHelper.java Sun Nov 13 06:16:54 2011
@@ -34,7 +34,6 @@ import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 
 import static org.apache.abdera2.common.misc.Comparisons.*;
-import static org.apache.abdera2.common.text.CharUtils.not_empty;
 
 /**
  * Utilities for working with MIME Media Types
@@ -300,20 +299,20 @@ public final class MimeTypeHelper {
      * "application/*", "image/png", "image/*") condenses to [application/*, image/*]
      */
     public static String[] condense(String... types) {
-        if (types.length <= 1)
-            return types;
-        List<String> res = new ArrayList<String>();
-        Arrays.sort(types, getComparator());
-        for (String t : types) {
-            if (!contains(t, res, true))
-                res.add(t);
-        }
-        for (int n = 0; n < res.size(); n++) {
-            String t = res.get(n);
-            if (contains(t, res, false))
-                res.remove(t);
-        }
-        return res.toArray(new String[res.size()]);
+      if (types == null) return new String[0];
+      if (types.length <= 1)
+          return types;
+      List<String> res = new ArrayList<String>();
+      Arrays.sort(types, getComparator());
+      for (String t : types)
+        if (!contains(t, res, true))
+          res.add(t);
+      for (int n = 0; n < res.size(); n++) {
+          String t = res.get(n);
+          if (contains(t, res, false))
+              res.remove(t);
+      }
+      return res.toArray(new String[res.size()]);
     }
 
     private static boolean contains(String t1, List<String> t, boolean self) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Chain.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Chain.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Chain.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/Chain.java Sun Nov 13 06:16:54 2011
@@ -17,13 +17,11 @@ package org.apache.abdera2.common.misc;
  * directory of this distribution.
  */
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Iterator;
-import java.util.List;
 
 import com.google.common.base.Function;
 import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
 
 import static com.google.common.base.Preconditions.*;
 
@@ -36,7 +34,7 @@ public final class Chain<T,R> 
 
     public Chain(Function<T,R> to, Task<T,R>... tasks) {
       this.to = to;
-      this.tasks = Arrays.asList(tasks).iterator();
+      this.tasks = ImmutableList.copyOf(tasks).iterator();
     }
     
     public Chain(Function<T,R> to, Iterable<Task<T,R>> tasks) {
@@ -62,8 +60,8 @@ public final class Chain<T,R> 
     }
     
     public static class Builder<T,R> {
-      private final List<Task<T,R>> tasks = 
-        new ArrayList<Task<T,R>>();
+      private final ImmutableList.Builder<Task<T,R>> tasks = 
+        ImmutableList.builder();
       private Function<T,R> finalTask;
       private Builder() {}
       public Builder<T,R> to(Function<T,R> finalTask) {
@@ -96,7 +94,7 @@ public final class Chain<T,R> 
       }
       public Chain<T,R> get() {
         checkNotNull(finalTask);
-        return new Chain<T,R>(finalTask,tasks);
+        return new Chain<T,R>(finalTask,tasks.build());
       }
     }
     

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MapRed.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MapRed.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MapRed.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MapRed.java Sun Nov 13 06:16:54 2011
@@ -33,8 +33,12 @@ import com.google.common.base.Equivalenc
 import com.google.common.base.Function;
 import com.google.common.base.Functions;
 import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
 
 /**
  * Provides lightweight, standalone MapReduce functionality without
@@ -212,12 +216,13 @@ public final class MapRed {
     return new MapperFunction<K1,V1,K2,V2>() {
       public Iterable<Pair<K2,Iterable<V2>>> apply(Iterable<Pair<K1,V1>> input) {
         SimpleCollector<K2,V2> context = new SimpleCollector<K2,V2>(nulls);
-        List<Pair<K2, Iterable<V2>>> list = new ArrayList<Pair<K2, Iterable<V2>>>();
+        ImmutableList.Builder<Pair<K2, Iterable<V2>>> list = 
+          ImmutableList.builder();
         for (Pair<K1, V1> entry : input)
           mapper.map(entry.first(), entry.second(), context);
         for (Map.Entry<K2, Iterable<V2>> entry : context.collected())
           list.add(Pair.of(entry.getKey(), entry.getValue()));
-        return list;
+        return list.build();
       }      
     };
   }
@@ -229,12 +234,12 @@ public final class MapRed {
     return new MapperFunction<K1,V1,K2,V2>() {
       public Iterable<Pair<K2,Iterable<V2>>> apply(Iterable<Pair<K1,V1>> input) {
         SimpleCollector<K2,V2> context = new SimpleCollector<K2,V2>(nulls,comparator);
-        List<Pair<K2, Iterable<V2>>> list = new ArrayList<Pair<K2, Iterable<V2>>>();
+        ImmutableList.Builder<Pair<K2, Iterable<V2>>> list = ImmutableList.builder();
         for (Pair<K1, V1> entry : input)
           mapper.map(entry.first(), entry.second(), context);
         for (Map.Entry<K2, Iterable<V2>> entry : context.collected())
           list.add(Pair.of(entry.getKey(), entry.getValue()));
-        return list;
+        return list.build();
       }      
     };
   }
@@ -257,12 +262,12 @@ public final class MapRed {
     return new ReducerFunction<K1,V1,K2,V2>() {
       public Iterable<Pair<K2,Iterable<V2>>> apply(Iterable<Pair<K1,Iterable<V1>>> input) {
         SimpleCollector<K2,V2> context = new SimpleCollector<K2,V2>(nulls, comparator);
-        List<Pair<K2, Iterable<V2>>> list = new ArrayList<Pair<K2, Iterable<V2>>>();
+        ImmutableList.Builder<Pair<K2, Iterable<V2>>> list = ImmutableList.builder();
         for (Pair<K1, Iterable<V1>> entry : input)
           reducer.reduce(entry.first(), entry.second().iterator(), context);
         for (Map.Entry<K2, Iterable<V2>> entry : context.collected())
           list.add(Pair.of(entry.getKey(), entry.getValue()));
-        return list;
+        return list.build();
       }      
     };
   }
@@ -273,12 +278,12 @@ public final class MapRed {
     return new ReducerFunction<K1,V1,K2,V2>() {
       public Iterable<Pair<K2,Iterable<V2>>> apply(Iterable<Pair<K1,Iterable<V1>>> input) {
         SimpleCollector<K2,V2> context = new SimpleCollector<K2,V2>(nulls);
-        List<Pair<K2, Iterable<V2>>> list = new ArrayList<Pair<K2, Iterable<V2>>>();
+        ImmutableList.Builder<Pair<K2, Iterable<V2>>> list = ImmutableList.builder();
         for (Pair<K1, Iterable<V1>> entry : input)
           reducer.reduce(entry.first(), entry.second().iterator(), context);
         for (Map.Entry<K2, Iterable<V2>> entry : context.collected())
           list.add(Pair.of(entry.getKey(), entry.getValue()));
-        return list;
+        return list.build();
       }      
     };
   }
@@ -466,9 +471,10 @@ public final class MapRed {
     return new PartitionFunction<T>() {
       public Iterable<Iterable<T>> apply(Iterable<T> input) {
         Iterable<List<T>> i = Iterables.<T>partition(input, size);
-        List<Iterable<T>> l = new ArrayList<Iterable<T>>();
-        Iterables.addAll(l, i);
-        return Iterables.unmodifiableIterable(l);
+        ImmutableList.Builder<Iterable<T>> l = ImmutableList.builder();
+        for (List<T> list : i)
+          l.add(list);
+        return l.build();
       }
     };
   }
@@ -498,9 +504,7 @@ public final class MapRed {
     return new CombinerFunction<T>() {
       public Iterable<T> apply(Iterable<Iterable<T>> input) {
         Iterable<T> c = Iterables.concat(input);
-        LinkedHashSet<T> l = new LinkedHashSet<T>();
-        Iterables.addAll(l, c);
-        return l;
+        return ImmutableSet.copyOf(c);
       }      
     };
   }
@@ -517,11 +521,10 @@ public final class MapRed {
     return new CombinerFunction<T>() {
       public Iterable<T> apply(Iterable<Iterable<T>> input) {
         Iterable<T> i = Iterables.concat(input);
-        List<T> l = new ArrayList<T>();
-        Iterables.addAll(l, i);
+        List<T> l = Lists.newArrayList(i);
         if (order != null)
           Collections.sort(l,order);
-        return l;
+        return ImmutableList.copyOf(l);
       }      
     };
   }
@@ -537,8 +540,7 @@ public final class MapRed {
     return new CombinerFunction<T>() {
       public Iterable<T> apply(Iterable<Iterable<T>> input) {
         Iterable<T> i = Iterables.concat(input);
-        List<T> l = new ArrayList<T>();
-        Iterables.addAll(l, i);
+        List<T> l = Lists.newArrayList(i);
         Collections.<T>sort(l);
         return l;
       }      
@@ -642,7 +644,11 @@ public final class MapRed {
       set.add(val);
     }
     public Iterable<Map.Entry<K,Iterable<V>>> collected() {  
-      return Collections.<Map.Entry<K,Iterable<V>>>unmodifiableSet(map.entrySet());
+      ImmutableMap.Builder<K,Iterable<V>> builder = 
+        ImmutableMap.builder();
+      for (Map.Entry<K,Iterable<V>> entry : map.entrySet())
+        builder.put(entry.getKey(), ImmutableList.copyOf(entry.getValue()));
+      return builder.build().entrySet();
     }
   }
 }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MoreFunctions.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MoreFunctions.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MoreFunctions.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MoreFunctions.java Sun Nov 13 06:16:54 2011
@@ -18,9 +18,7 @@
 package org.apache.abdera2.common.misc;
 
 import java.lang.reflect.Constructor;
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -53,13 +51,11 @@ public final class MoreFunctions {
   }
   
   public static <T,S>Set<S> immutableSetOf(T[] items, Function<T,S> transform, Class<S> _class) {
-    S[] set = each(items, transform, _class);
-    return ImmutableSet.<S>copyOf(set);
+    return ImmutableSet.<S>copyOf(each(items, transform, _class));
   }
   
   public static <T,S>List<S> immutableListOf(T[] items, Function<T,S> transform, Class<S> _class) {
-    S[] set = each(items, transform, _class);
-    return ImmutableList.<S>copyOf(set);
+    return ImmutableList.<S>copyOf(each(items, transform, _class));
   }
   
   @SuppressWarnings({ "unchecked", "rawtypes" })
@@ -298,7 +294,7 @@ public final class MoreFunctions {
     return new Function<T[],T>() {
       public T apply(T[] input) {
         try {
-          return Iterables.<T>find(Arrays.asList(input), predicate);
+          return Iterables.<T>find(ImmutableList.copyOf(input), predicate);
         } catch (Throwable t) {
           return def;
         }
@@ -364,7 +360,7 @@ public final class MoreFunctions {
   }
   
   public static <T,X>Iterable<X> each(Iterable<T> i, Function<T,X> apply) {
-    List<X> list = new ArrayList<X>();
+    ImmutableList.Builder<X> list = ImmutableList.builder();
     for (T t : i) {
       try {
         list.add(apply.apply(t));
@@ -372,11 +368,11 @@ public final class MoreFunctions {
         throw ExceptionHelper.propogate(e);
       }
     }
-    return Iterables.<X>unmodifiableIterable(list);
+    return list.build();
   }
   
   public static <T,X>Iterable<X> each(Iterable<T> i, Function<T,X> apply, Predicate<T> test) {
-    List<X> list = new ArrayList<X>();
+    ImmutableList.Builder<X> list = ImmutableList.builder();
     for (T t : i) {
       try {
         if (test.apply(t))
@@ -385,16 +381,16 @@ public final class MoreFunctions {
         throw ExceptionHelper.propogate(e);
       }
     }
-    return Iterables.<X>unmodifiableIterable(list);
+    return list.build();
   }
   
   public static <T,X>X[] each(T[] i, Function<T,X> apply, Class<X> _class) {
-    Iterable<X> x = MoreFunctions.<T,X>each(Arrays.<T>asList(i),apply);
+    Iterable<X> x = MoreFunctions.<T,X>each(ImmutableList.copyOf(i),apply);
     return Iterables.<X>toArray(x, _class);
   }
   
   public static <T,X>X[] each(T[] i, Function<T,X> apply,Predicate<T> pred, Class<X> _class) {
-    Iterable<X> x = MoreFunctions.<T,X>each(Arrays.<T>asList(i),apply,pred);
+    Iterable<X> x = MoreFunctions.<T,X>each(ImmutableList.copyOf(i),apply,pred);
     return Iterables.<X>toArray(x, _class);
   }
   
@@ -403,8 +399,8 @@ public final class MoreFunctions {
   }
   
   public static class ChoiceGenerator<T,R> implements Supplier<Function<T,R>> {
-    final Set<Choice.Option<T,R>> options = 
-      new LinkedHashSet<Choice.Option<T,R>>();
+    final ImmutableSet.Builder<Choice.Option<T,R>> options = 
+      ImmutableSet.builder();
      Supplier<R> otherwise;
     public ChoiceGenerator<T,R> of(Choice.Option<T,R> option) {
       this.options.add(option);
@@ -424,18 +420,17 @@ public final class MoreFunctions {
       return otherwise(Suppliers.ofInstance(instance));
     }
     public Function<T,R> get() {
-      return new Choice<T,R>(options,otherwise);
+      return new Choice<T,R>(options.build(),otherwise);
     }
   }
   
   static class Choice<T,R> implements Function<T,R> {    
     public static interface Option<T,R>
     extends Predicate<T>, Supplier<R> {}
-    private final Set<Choice.Option<T,R>> options = 
-      new LinkedHashSet<Choice.Option<T,R>>();
+    private final ImmutableSet<Choice.Option<T,R>> options;
     private final Supplier<R> otherwise;
-    Choice(Set<Choice.Option<T,R>> options, Supplier<R> otherwise) {
-      this.options.addAll(options);
+    Choice(ImmutableSet<Choice.Option<T,R>> options, Supplier<R> otherwise) {
+      this.options = options;
       this.otherwise = otherwise;
     }
     public R apply(T input) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/MapChannelManager.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/MapChannelManager.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/MapChannelManager.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/MapChannelManager.java Sun Nov 13 06:16:54 2011
@@ -30,8 +30,8 @@ public abstract class MapChannelManager 
   implements ChannelManager {
 
   public static abstract class Channel {
-    private final Pusher<?> pusher;
-    private final Receiver<?> receiver;
+    final Pusher<?> pusher;
+    final Receiver<?> receiver;
     public Channel(Pusher<?> pusher, Receiver<?> receiver) {
       this.pusher = pusher;
       this.receiver = receiver;

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/SimplePusher.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/SimplePusher.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/SimplePusher.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/pusher/SimplePusher.java Sun Nov 13 06:16:54 2011
@@ -22,21 +22,20 @@ import java.util.HashSet;
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.ExecutorService;
 
+import org.apache.abdera2.common.misc.MoreExecutors2;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 public class SimplePusher<T> 
   extends AbstractPusher<T> implements Pusher<T>, Receiver<T> {
 
-  private final static Log log = LogFactory.getLog(SimplePusher.class);
+  final static Log log = LogFactory.getLog(SimplePusher.class);
   
-  private final Queue<T> queue = new ConcurrentLinkedQueue<T>();
-  private final ThreadPoolExecutor exec = 
-    (ThreadPoolExecutor) Executors.newCachedThreadPool();
-  private final Set<Listener<T>> listeners = 
+  final Queue<T> queue = new ConcurrentLinkedQueue<T>();
+  final ExecutorService exec = MoreExecutors2.getExitingExecutor();
+  final Set<Listener<T>> listeners = 
     new HashSet<Listener<T>>();
   
   public void startListening(Listener<T> listener) {
@@ -99,8 +98,6 @@ public class SimplePusher<T> 
   }
   
   public void shutdown() {
-    ThreadPoolExecutor exec = (ThreadPoolExecutor) this.exec;
-    exec.shutdown();
     for (Listener<?> listener : listeners)
       listener.afterItems();
     listeners.clear(); // remove all the listeners

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CodepointMatcher.java Sun Nov 13 06:16:54 2011
@@ -223,7 +223,7 @@ public abstract class CodepointMatcher 
     }
   }
   
-  private static boolean invset_contains(int[] set, int value) {
+  static boolean invset_contains(int[] set, int value) {
       int s = 0, e = set.length;
       while (e - s > 8) {
           int i = (e + s) >> 1;

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/UrlEncoding.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/UrlEncoding.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/UrlEncoding.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/UrlEncoding.java Sun Nov 13 06:16:54 2011
@@ -546,7 +546,7 @@ public final class UrlEncoding {
             : (c >= 'a' && c <= 'f') ? c - 'a' + 10 : -1) & 0xf) << shift);
     }
 
-    private static byte decode(char c1, char c2) {
+    static byte decode(char c1, char c2) {
         return (byte)(decode(c1, 4) | decode(c2, 0));
     }
 

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/activities/ActivityToFeedConverter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/activities/ActivityToFeedConverter.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/activities/ActivityToFeedConverter.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/activities/ActivityToFeedConverter.java Sun Nov 13 06:16:54 2011
@@ -137,10 +137,10 @@ public class ActivityToFeedConverter {
       summary(activity,writer);
       if (activity.getUpdated() != null)
         writer.writeUpdated(activity.getUpdated());
-      else writer.writeUpdated(DateTime.now());
+      else writer.writeUpdatedNow();
       if (activity.getPublished() != null)
         writer.writePublished(activity.getPublished());
-      else writer.writePublished(DateTime.now());
+      else writer.writePublishedNow();
       if (activity.getUrl() != null)
         writer.writeLink(activity.getUrl().toString());
       actor(activity,writer);

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/bidi/BidiHelper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/bidi/BidiHelper.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/bidi/BidiHelper.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/bidi/BidiHelper.java Sun Nov 13 06:16:54 2011
@@ -18,7 +18,6 @@
 package org.apache.abdera2.ext.bidi;
 
 import java.text.AttributedString;
-import java.util.Arrays;
 import java.util.Locale;
 
 import javax.xml.namespace.QName;
@@ -28,6 +27,8 @@ import org.apache.abdera2.model.Base;
 import org.apache.abdera2.model.Document;
 import org.apache.abdera2.model.Element;
 
+import com.google.common.collect.ImmutableSet;
+
 /**
  * <p>
  * This is (hopefully) temporary. Ideally, this would be wrapped into the core model API so that the bidi stuff is
@@ -275,33 +276,36 @@ public final class BidiHelper {
       UNSPECIFIED, LTR, RTL
   };
 
-  private static final String[] RTL_LANGS = {"ar", "dv", "fa", "he", "ps", "syr", "ur", "yi"};
+  private static final ImmutableSet<String> RTL_LANGS = 
+    ImmutableSet.of("ar", "dv", "fa", "he", "ps", "syr", "ur", "yi");
+
+  private static final ImmutableSet<String> RTL_SCRIPTS =
+    ImmutableSet.of(
+       "arab", "avst", "hebr", "hung", "lydi", "mand", "mani", 
+       "mero", "mong", "nkoo", "orkh", "phlv", "phnx",
+       "samr", "syrc", "syre", "syrj", "syrn", "tfng", "thaa");
 
-  private static final String[] RTL_SCRIPTS =
-      {"arab", "avst", "hebr", "hung", "lydi", "mand", "mani", "mero", "mong", "nkoo", "orkh", "phlv", "phnx",
-       "samr", "syrc", "syre", "syrj", "syrn", "tfng", "thaa"};
-  // charset encodings that one may typically expect to be RTL
-  private static final String[] RTL_ENCODINGS =
-      {"iso-8859-6", "iso-8859-6-bidi", "iso-8859-6-i", "iso-ir-127", "ecma-114", "asmo-708", "arabic",
+  private static final ImmutableSet<String> RTL_ENCODINGS =
+     ImmutableSet.of("iso-8859-6", "iso-8859-6-bidi", "iso-8859-6-i", "iso-ir-127", "ecma-114", "asmo-708", "arabic",
        "csisolatinarabic", "windows-1256", "ibm-864", "macarabic", "macfarsi", "iso-8859-8-i", "iso-8859-8-bidi",
        "windows-1255", "iso-8859-8", "ibm-862", "machebrew", "asmo-449", "iso-9036", "arabic7", "iso-ir-89",
        "csiso89asmo449", "iso-unicode-ibm-1264", "csunicodeibm1264", "iso_8859-8:1988", "iso-ir-138", "hebrew",
-       "csisolatinhebrew", "iso-unicode-ibm-1265", "csunicodeibm1265", "cp862", "862", "cspc862latinhebrew"};
+       "csisolatinhebrew", "iso-unicode-ibm-1265", "csunicodeibm1265", "cp862", "862", "cspc862latinhebrew");
 
   /**
    * Algorithm that will determine text direction by looking at the characteristics of the language tag. If the tag
    * uses a language or script that is known to be RTL, then Direction.RTL will be returned
    */
   public static Direction guessDirectionFromLanguage(Lang lang) {
-      if (lang.script() != null) {
-          String script = lang.script().name();
-          if (Arrays.binarySearch(RTL_SCRIPTS, script.toLowerCase()) > -1)
-              return Direction.RTL;
-      }
-      String primary = lang.language().name();
-      if (Arrays.binarySearch(RTL_LANGS, primary.toLowerCase()) > -1)
+    if (lang.script() != null) {
+      String script = lang.script().name();
+      if (RTL_SCRIPTS.contains(script.toLowerCase()))
           return Direction.RTL;
-      return Direction.UNSPECIFIED;
+    }
+    String primary = lang.language().name();
+    if (RTL_LANGS.contains(primary.toLowerCase()))
+      return Direction.RTL;
+    return Direction.UNSPECIFIED;
   }
 
   /**
@@ -309,13 +313,12 @@ public final class BidiHelper {
    * typically used for RTL languages, Direction.RTL will be returned
    */
   public static Direction guessDirectionFromEncoding(String charset) {
-      if (charset == null)
-          return Direction.UNSPECIFIED;
-      charset = charset.replace('_', '-');
-      Arrays.sort(RTL_ENCODINGS);
-      if (Arrays.binarySearch(RTL_ENCODINGS, charset.toLowerCase()) > -1)
-          return Direction.RTL;
-      return Direction.UNSPECIFIED;
+    if (charset == null)
+        return Direction.UNSPECIFIED;
+    charset = charset.replace('_', '-');
+    if (RTL_ENCODINGS.contains(charset.toLowerCase()))
+        return Direction.RTL;
+    return Direction.UNSPECIFIED;
   }
 
   /**
@@ -323,22 +326,22 @@ public final class BidiHelper {
    * text are RTL characters, then Direction.RTL will be returned.
    */
   public static Direction guessDirectionFromTextProperties(String text) {
-      if (text != null && text.length() > 0) {
-          if (text.charAt(0) == 0x200F)
-              return Direction.RTL; // if using the unicode right-to-left mark
-          if (text.charAt(0) == 0x200E)
-              return Direction.LTR; // if using the unicode left-to-right mark
-          int c = 0;
-          for (int n = 0; n < text.length(); n++) {
-              char ch = text.charAt(n);
-              if (java.text.Bidi.requiresBidi(new char[] {ch}, 0, 1))
-                  c++;
-              else
-                  c--;
-          }
-          return c > 0 ? Direction.RTL : Direction.LTR;
-      }
-      return Direction.UNSPECIFIED;
+    if (text != null && text.length() > 0) {
+        if (text.charAt(0) == 0x200F)
+            return Direction.RTL; // if using the unicode right-to-left mark
+        if (text.charAt(0) == 0x200E)
+            return Direction.LTR; // if using the unicode left-to-right mark
+        int c = 0;
+        for (int n = 0; n < text.length(); n++) {
+            char ch = text.charAt(n);
+            if (java.text.Bidi.requiresBidi(new char[] {ch}, 0, 1))
+                c++;
+            else
+                c--;
+        }
+        return c > 0 ? Direction.RTL : Direction.LTR;
+    }
+    return Direction.UNSPECIFIED;
   }
 
   /**

Modified: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/features/Feature.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/features/Feature.java?rev=1201407&r1=1201406&r2=1201407&view=diff
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/features/Feature.java (original)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/features/Feature.java Sun Nov 13 06:16:54 2011
@@ -20,9 +20,6 @@ package org.apache.abdera2.ext.features;
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.activation.MimeType;
-import javax.activation.MimeTypeParseException;
-
 import org.apache.abdera2.factory.Factory;
 import org.apache.abdera2.common.anno.QName;
 import org.apache.abdera2.common.iri.IRI;
@@ -30,6 +27,7 @@ import org.apache.abdera2.model.Element;
 import org.apache.abdera2.model.ExtensibleElementWrapper;
 import org.apache.abdera2.common.mediatype.MimeTypeHelper;
 import static org.apache.abdera2.ext.features.FeaturesHelper.*;
+import static com.google.common.base.Preconditions.*;
 
 @QName(value="feature", 
     ns=FNS,
@@ -59,16 +57,14 @@ public class Feature extends ExtensibleE
     }
 
     public void setRef(String ref) {
-        if (ref == null)
-            throw new IllegalArgumentException();
-        setAttributeValue("ref", (new IRI(ref)).toString());
+      setAttributeValue("ref", (new IRI(checkNotNull(ref))).toString());
     }
 
     public void setHref(String href) {
-        if (href != null)
-            setAttributeValue("href", (new IRI(href)).toString());
-        else
-            removeAttribute("href");
+      if (href != null)
+        setAttributeValue("href", (new IRI(href)).toString());
+      else
+        removeAttribute("href");
     }
 
     public void setLabel(String label) {



Mime
View raw message