Repository: incubator-juneau
Updated Branches:
  refs/heads/master 2c59a4f09 -> 39e1dba63


Rename Link to LinkString.

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/39e1dba6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/39e1dba6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/39e1dba6

Branch: refs/heads/master
Commit: 39e1dba63475b72af8cd3c900d6d914744d80ccc
Parents: 2c59a4f
Author: JamesBognar <[email protected]>
Authored: Fri Oct 6 11:37:25 2017 -0400
Committer: JamesBognar <[email protected]>
Committed: Fri Oct 6 11:37:25 2017 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/juneau/dto/Link.java   | 148 -------------------
 .../java/org/apache/juneau/dto/LinkString.java  | 148 +++++++++++++++++++
 juneau-doc/src/main/javadoc/overview.html       |   7 +
 .../examples/rest/TumblrParserResource.java     |   4 +-
 .../rest/addressbook/AddressBookResource.java   |  10 +-
 .../microservice/resources/LogsResource.java    |   4 +-
 .../rest/remoteable/RemoteableServlet.java      |   8 +-
 7 files changed, 168 insertions(+), 161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39e1dba6/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/Link.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/Link.java 
b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/Link.java
deleted file mode 100644
index 6677dc0..0000000
--- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/Link.java
+++ /dev/null
@@ -1,148 +0,0 @@
-// 
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
-// * to you 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.  See the License for the        *
-// * specific language governing permissions and limitations under the 
License.                                              *
-// 
***************************************************************************************************************************
-package org.apache.juneau.dto;
-
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.text.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.html.*;
-import org.apache.juneau.urlencoding.*;
-import org.apache.juneau.utils.*;
-
-/**
- * Simple bean that implements a hyperlink for the HTML serializer.
- *
- * <p>
- * The name and url properties correspond to the following parts of a 
hyperlink in an HTML document...
- * <p class='bcode'>
- *     <xt>&lt;a</xt> 
<xa>href</xa>=<xs>'href'</xs><xt>&gt;</xt>name<xt>&lt;/a&gt;</xt>
- * </p>
- *
- * <p>
- * When encountered by the {@link HtmlSerializer} class, this object gets 
converted to a hyperlink.
- * All other serializers simply convert it to a simple bean.
- */
-@HtmlLink(nameProperty = "name", hrefProperty = "href")
-public class Link implements Comparable<Link> {
-       private String name, href;
-
-       /** No-arg constructor. */
-       public Link() {}
-
-       /**
-        * Constructor.
-        *
-        * @param name Corresponds to the text inside of the <xt>&lt;A&gt;</xt> 
element.
-        * @param href Corresponds to the value of the <xa>href</xa> attribute 
of the <xt>&lt;A&gt;</xt> element.
-        * @param hrefArgs Optional arguments for {@link MessageFormat} style 
arguments in the href.
-        */
-       public Link(String name, String href, Object...hrefArgs) {
-               setName(name);
-               setHref(href, hrefArgs);
-       }
-
-
-       
//--------------------------------------------------------------------------------
-       // Bean properties
-       
//--------------------------------------------------------------------------------
-
-       /**
-        * Bean property getter:  <property>name</property>.
-        *
-        * <p>
-        * Corresponds to the text inside of the <xt>&lt;A&gt;</xt> element.
-        *
-        * @return The value of the <property>name</property> property on this 
bean, or <jk>null</jk> if it is not set.
-        */
-       public String getName() {
-               return name;
-       }
-
-       /**
-        * Bean property setter:  <property>name</property>.
-        *
-        * @param name The new value for the <property>name</property> property 
on this bean.
-        * @return This object (for method chaining).
-        */
-       public Link setName(String name) {
-               this.name = name;
-               return this;
-       }
-
-       /**
-        * Bean property getter:  <property>href</property>.
-        *
-        * <p>
-        * Corresponds to the value of the <xa>href</xa> attribute of the 
<xt>&lt;A&gt;</xt> element.
-        *
-        * @return The value of the <property>href</property> property on this 
bean, or <jk>null</jk> if it is not set.
-        */
-       public String getHref() {
-               return href;
-       }
-
-       /**
-        * Bean property setter:  <property>href</property>.
-        *
-        * @param href The new value for the <property>href</property> property 
on this bean.
-        * @return This object (for method chaining).
-        */
-       public Link setHref(String href) {
-               setHref(href, new Object[0]);
-               return this;
-       }
-
-       /**
-        * Bean property setter:  <property>href</property>.
-        *
-        * <p>
-        * Same as {@link #setHref(String)} except allows for {@link 
MessageFormat} style arguments.
-        *
-        * @param href The new href.
-        * @param args Optional {@link MessageFormat}-style arguments.
-        * @return This object (for method chaining).
-        */
-       public Link setHref(String href, Object...args) {
-               for (int i = 0; i < args.length; i++)
-                       args[i] = 
UrlEncodingSerializer.DEFAULT.serialize(PartType.PATH, args[i]);
-               this.href = format(href, args);
-               return this;
-       }
-
-       /**
-        * Returns the name so that the {@link PojoQuery} class can search 
against it.
-        */
-       @Override /* Object */
-       public String toString() {
-               return name;
-       }
-
-       @Override /* Comparable */
-       public int compareTo(Link o) {
-               return name.compareTo(o.name);
-       }
-
-       @Override /* Object */
-       public boolean equals(Object o) {
-               if (! (o instanceof Link))
-                       return false;
-               return (compareTo((Link)o) == 0);
-       }
-
-       @Override /* Object */
-       public int hashCode() {
-               return super.hashCode();
-       }
-}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39e1dba6/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/LinkString.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/LinkString.java 
b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/LinkString.java
new file mode 100644
index 0000000..8a7031e
--- /dev/null
+++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/LinkString.java
@@ -0,0 +1,148 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you 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.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.dto;
+
+import static org.apache.juneau.internal.StringUtils.*;
+
+import java.text.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.html.*;
+import org.apache.juneau.urlencoding.*;
+import org.apache.juneau.utils.*;
+
+/**
+ * Simple bean that implements a hyperlink for the HTML serializer.
+ *
+ * <p>
+ * The name and url properties correspond to the following parts of a 
hyperlink in an HTML document...
+ * <p class='bcode'>
+ *     <xt>&lt;a</xt> 
<xa>href</xa>=<xs>'href'</xs><xt>&gt;</xt>name<xt>&lt;/a&gt;</xt>
+ * </p>
+ *
+ * <p>
+ * When encountered by the {@link HtmlSerializer} class, this object gets 
converted to a hyperlink.
+ * All other serializers simply convert it to a simple bean.
+ */
+@HtmlLink(nameProperty = "name", hrefProperty = "href")
+public class LinkString implements Comparable<LinkString> {
+       private String name, href;
+
+       /** No-arg constructor. */
+       public LinkString() {}
+
+       /**
+        * Constructor.
+        *
+        * @param name Corresponds to the text inside of the <xt>&lt;A&gt;</xt> 
element.
+        * @param href Corresponds to the value of the <xa>href</xa> attribute 
of the <xt>&lt;A&gt;</xt> element.
+        * @param hrefArgs Optional arguments for {@link MessageFormat} style 
arguments in the href.
+        */
+       public LinkString(String name, String href, Object...hrefArgs) {
+               setName(name);
+               setHref(href, hrefArgs);
+       }
+
+
+       
//--------------------------------------------------------------------------------
+       // Bean properties
+       
//--------------------------------------------------------------------------------
+
+       /**
+        * Bean property getter:  <property>name</property>.
+        *
+        * <p>
+        * Corresponds to the text inside of the <xt>&lt;A&gt;</xt> element.
+        *
+        * @return The value of the <property>name</property> property on this 
bean, or <jk>null</jk> if it is not set.
+        */
+       public String getName() {
+               return name;
+       }
+
+       /**
+        * Bean property setter:  <property>name</property>.
+        *
+        * @param name The new value for the <property>name</property> property 
on this bean.
+        * @return This object (for method chaining).
+        */
+       public LinkString setName(String name) {
+               this.name = name;
+               return this;
+       }
+
+       /**
+        * Bean property getter:  <property>href</property>.
+        *
+        * <p>
+        * Corresponds to the value of the <xa>href</xa> attribute of the 
<xt>&lt;A&gt;</xt> element.
+        *
+        * @return The value of the <property>href</property> property on this 
bean, or <jk>null</jk> if it is not set.
+        */
+       public String getHref() {
+               return href;
+       }
+
+       /**
+        * Bean property setter:  <property>href</property>.
+        *
+        * @param href The new value for the <property>href</property> property 
on this bean.
+        * @return This object (for method chaining).
+        */
+       public LinkString setHref(String href) {
+               setHref(href, new Object[0]);
+               return this;
+       }
+
+       /**
+        * Bean property setter:  <property>href</property>.
+        *
+        * <p>
+        * Same as {@link #setHref(String)} except allows for {@link 
MessageFormat} style arguments.
+        *
+        * @param href The new href.
+        * @param args Optional {@link MessageFormat}-style arguments.
+        * @return This object (for method chaining).
+        */
+       public LinkString setHref(String href, Object...args) {
+               for (int i = 0; i < args.length; i++)
+                       args[i] = 
UrlEncodingSerializer.DEFAULT.serialize(PartType.PATH, args[i]);
+               this.href = format(href, args);
+               return this;
+       }
+
+       /**
+        * Returns the name so that the {@link PojoQuery} class can search 
against it.
+        */
+       @Override /* Object */
+       public String toString() {
+               return name;
+       }
+
+       @Override /* Comparable */
+       public int compareTo(LinkString o) {
+               return name.compareTo(o.name);
+       }
+
+       @Override /* Object */
+       public boolean equals(Object o) {
+               if (! (o instanceof LinkString))
+                       return false;
+               return (compareTo((LinkString)o) == 0);
+       }
+
+       @Override /* Object */
+       public int hashCode() {
+               return super.hashCode();
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39e1dba6/juneau-doc/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/juneau-doc/src/main/javadoc/overview.html 
b/juneau-doc/src/main/javadoc/overview.html
index bd03c71..582a15a 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -7458,6 +7458,13 @@
                                New class {@link 
org.apache.juneau.http.HttpMethodName} with valid static string HTTP method 
names.
                </ul>
                
+               <h6 class='topic'>juneau-dto</h6>
+               <ul class='spaced-list'>
+                       <li>
+                               Class <code>org.apache.juneau.dto.Link</code> 
renamed to {@link org.apache.juneau.dto.LinkString}.
+                               Helps avoid confusion since there are other 
Link classes in the library.
+               </ul>
+
                <h6 class='topic'>juneau-rest-server</h6>
                <ul class='spaced-list'>
                        <li>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39e1dba6/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java
----------------------------------------------------------------------
diff --git 
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java
 
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java
index 3cc7853..1bb3e93 100644
--- 
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java
+++ 
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java
@@ -15,7 +15,7 @@ package org.apache.juneau.examples.rest;
 import static org.apache.juneau.http.HttpMethodName.*;
 
 import org.apache.juneau.*;
-import org.apache.juneau.dto.Link;
+import org.apache.juneau.dto.LinkString;
 import org.apache.juneau.dto.html5.*;
 import org.apache.juneau.microservice.*;
 import org.apache.juneau.rest.annotation.*;
@@ -67,7 +67,7 @@ public class TumblrParserResource extends Resource {
                                        Entry e = new Entry();
                                        e.date = om.getString("date");
                                        if (type.equals("link"))
-                                               e.entry = new 
Link(om.getString("link-text"), om.getString("link-url"));
+                                               e.entry = new 
LinkString(om.getString("link-text"), om.getString("link-url"));
                                        else if (type.equals("audio"))
                                                e.entry = new 
ObjectMap().append("type","audio").append("audio-caption", 
om.getString("audio-caption"));
                                        else if (type.equals("video"))

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39e1dba6/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
----------------------------------------------------------------------
diff --git 
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
 
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
index 2cc0212..a871628 100644
--- 
a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
+++ 
b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
@@ -21,7 +21,7 @@ import static org.apache.juneau.http.HttpMethodName.*;
 import java.util.*;
 
 import org.apache.juneau.*;
-import org.apache.juneau.dto.Link;
+import org.apache.juneau.dto.LinkString;
 import org.apache.juneau.dto.cognos.*;
 import org.apache.juneau.encoders.*;
 import org.apache.juneau.examples.addressbook.*;
@@ -143,10 +143,10 @@ public class AddressBookResource extends ResourceJena {
         * Get root page.
         */
        @RestMethod(name=GET, path="/")
-       public Link[] getRoot() throws Exception {
-               return new Link[] {
-                       new Link("people", "people"),
-                       new Link("addresses", "addresses")
+       public LinkString[] getRoot() throws Exception {
+               return new LinkString[] {
+                       new LinkString("people", "people"),
+                       new LinkString("addresses", "addresses")
                };
        }
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39e1dba6/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
----------------------------------------------------------------------
diff --git 
a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
 
b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
index 4605757..f02458b 100755
--- 
a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
+++ 
b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
@@ -25,7 +25,7 @@ import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
-import org.apache.juneau.dto.Link;
+import org.apache.juneau.dto.LinkString;
 import org.apache.juneau.ini.*;
 import org.apache.juneau.microservice.*;
 import org.apache.juneau.rest.*;
@@ -314,7 +314,7 @@ public class LogsResource extends Resource {
                public FileResource(File f, URI uri) throws Exception {
                        this.f = f;
                        this.type = (f.isDirectory() ? "dir" : "file");
-                       this.name = f.isDirectory() ? new Link(f.getName(), 
uri.toString()) : f.getName();
+                       this.name = f.isDirectory() ? new 
LinkString(f.getName(), uri.toString()) : f.getName();
                        this.size = f.isDirectory() ? null : f.length();
                        this.lastModified = new Date(f.lastModified());
                        if (f.canRead() && ! f.isDirectory()) {

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/39e1dba6/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
index 6e27cd6..eb015c9 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/remoteable/RemoteableServlet.java
@@ -19,7 +19,7 @@ import java.util.*;
 import java.util.concurrent.*;
 
 import org.apache.juneau.*;
-import org.apache.juneau.dto.Link;
+import org.apache.juneau.dto.LinkString;
 import org.apache.juneau.parser.*;
 import org.apache.juneau.rest.*;
 import org.apache.juneau.rest.annotation.*;
@@ -68,12 +68,12 @@ public abstract class RemoteableServlet extends 
RestServletDefault {
         * @throws Exception
         */
        @RestMethod(name=GET, path="/")
-       public List<Link> getInterfaces(RestRequest req) throws Exception {
-               List<Link> l = new LinkedList<Link>();
+       public List<LinkString> getInterfaces(RestRequest req) throws Exception 
{
+               List<LinkString> l = new LinkedList<LinkString>();
                boolean useAll = ! useOnlyAnnotated();
                for (Class<?> c : getServiceMap().keySet()) {
                        if (useAll || 
getContext().getBeanContext().getClassMeta(c).isRemoteable())
-                               l.add(new Link(c.getName(), "{0}/{1}", 
req.getRequestURI(), c.getName()));
+                               l.add(new LinkString(c.getName(), "{0}/{1}", 
req.getRequestURI(), c.getName()));
                }
                return l;
        }

Reply via email to