@Override
 public PathSegmentImpl clone() {
   try {
     PathSegmentImpl ps = (PathSegmentImpl) super.clone();
     if (matrixParams != null) {
       ps.matrixParams = ((MultivaluedMapImpl<String, String>) matrixParams).clone();
     }
     return ps;
   } catch (CloneNotSupportedException e) {
     // shouldn't happen
     throw new WebApplicationException(e);
   }
 }
 public static PathSegmentImpl decode(PathSegment segment) {
   PathSegmentImpl clone = new PathSegmentImpl();
   clone.path = UriEncoder.decodeString(segment.getPath());
   clone.matrixParams = UriEncoder.decodeMultivaluedMap(segment.getMatrixParameters(), true);
   return clone;
 }