001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.rest.beans;
014
015import org.apache.juneau.dto.html5.*;
016
017/**
018 * Defines a simple hyperlink class.
019 *
020 * <h5 class='figure'>Examples:</h5>
021 * <p class='bjava'>
022 *    <ja>@Rest</ja>
023 *    <jk>public class</jk> MyRest <jk>extends</jk> BasicRestServlet {
024 *
025 *       <jc>// Produces &lt;a href=&quot;/foo&quot;&gt;bar&lt;/a&gt;</jc>
026 *       <ja>@RestGet</ja>
027 *       <jk>public</jk> Hyperlink a01() {
028 *          <jk>return new</jk> Hyperlink(<js>"foo"</js>, <js>"bar"</js>);
029 *       }
030 *
031 *       <jc>// Produces &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;/foo&quot;&gt;bar&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</jc>
032 *       <ja>@RestGet</ja>
033 *       <jk>public</jk> Hyperlink[] a02() {
034 *          <jk>return new</jk> Hyperlink[]{a01()};
035 *       }
036 *
037 *       <jc>// Produces &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;/foo&quot;&gt;bar&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</jc>
038 *       <ja>@RestGet</ja>
039 *       <jk>public</jk> Collection&lt;Hyperlink&gt; a03() {
040 *          <jk>return</jk> Arrays.<jsm>asList</jsm>(a02());
041 *       }
042 *    }
043 * </p>
044 *
045 * <h5 class='section'>See Also:</h5><ul>
046 *    <li class='link'><a class="doclink" href="../../../../../index.html#jrs.UtilityBeans">Utility Beans</a>
047 * </ul>
048 */
049public class Hyperlink extends A {
050
051   //-----------------------------------------------------------------------------------------------------------------
052   // Static
053   //-----------------------------------------------------------------------------------------------------------------
054
055   /**
056    * Static creator.
057    *
058    * @param href The {@link A#href(Object)} attribute.
059    * @param children The {@link A#children(Object[])} nodes.
060    * @return A new {@link Hyperlink} object.
061    */
062   public static Hyperlink create(Object href, Object...children) {
063      return new Hyperlink(href, children);
064   }
065
066   //-----------------------------------------------------------------------------------------------------------------
067   // Implementation
068   //-----------------------------------------------------------------------------------------------------------------
069
070   /**
071    * Creates an empty {@link A} element.
072    */
073   public Hyperlink() {}
074
075   /**
076    * Creates an {@link A} element with the specified {@link A#href(Object)} attribute and {@link A#children(Object[])}
077    * nodes.
078    *
079    * @param href The {@link A#href(Object)} attribute.
080    * @param children The {@link A#children(Object[])} nodes.
081    */
082   public Hyperlink(Object href, Object...children) {
083      super(href, children);
084   }
085}