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.dto.html5;
014
015import org.apache.juneau.annotation.*;
016import org.apache.juneau.xml.annotation.*;
017
018/**
019 * A subclass of HTML elements that contain text only.
020 *
021 * <ul class='seealso'>
022 *    <li class='link'>{@doc juneau-dto.HTML5}
023 * </ul>
024 */
025public class HtmlElementText extends HtmlElement {
026
027   private Object text;
028
029   /**
030    * Returns the inner text of this element.
031    *
032    * @return The inner text of this element, or <jk>null</jk> if no text is set.
033    */
034   @Xml(format=XmlFormat.TEXT)
035   @Beanp("c")
036   public Object getText() {
037      return text;
038   }
039
040   /**
041    * Sets the inner text of this element.
042    *
043    * @param text The inner text of this element, or <jk>null</jk> if no text is set.
044    * @return This object (for method chaining).
045    */
046   @Beanp("c")
047   public HtmlElement setText(Object text) {
048      this.text = text;
049      return this;
050   }
051
052   /**
053    * Sets the text node on this element.
054    *
055    * @param text The text node to add to this element.
056    * @return This object (for method chaining).
057    */
058   public HtmlElement text(Object text) {
059      this.text = text;
060      return this;
061   }
062}