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.helper; 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='bcode w800> 022 * <ja>@Rest</ja> 023 * <jk>public class</jk> MyRest <jk>extends</jk> BasicRestServlet { 024 * 025 * <jc>// Produces <a href="/foo">bar</a></jc> 026 * <ja>@RestMethod</ja> 027 * <jk>public</jk> Hyperlink a01() { 028 * <jk>return new</jk> Hyperlink(<js>"foo"</js>, <js>"bar"</js>); 029 * } 030 * 031 * <jc>// Produces <ul><li><a href="/foo">bar</a></li></ul></jc> 032 * <ja>@RestMethod</ja> 033 * <jk>public</jk> Hyperlink[] a02() { 034 * <jk>return new</jk> Hyperlink[]{a01()}; 035 * } 036 * 037 * <jc>// Produces <ul><li><a href="/foo">bar</a></li></ul></jc> 038 * <ja>@RestMethod</ja> 039 * <jk>public</jk> Collection<Hyperlink> a03() { 040 * <jk>return</jk> Arrays.<jsm>asList</jsm>(a02()); 041 * } 042 * } 043 * </p> 044 */ 045public class Hyperlink extends A { 046 /** 047 * Creates an empty {@link A} element. 048 */ 049 public Hyperlink() {} 050 051 /** 052 * Creates an {@link A} element with the specified {@link A#href(Object)} attribute and {@link A#children(Object[])} 053 * nodes. 054 * 055 * @param href The {@link A#href(Object)} attribute. 056 * @param children The {@link A#children(Object[])} nodes. 057 */ 058 public Hyperlink(Object href, Object...children) { 059 super(href, children); 060 } 061}