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.*;
016
017/**
018 * DTO for an HTML {@doc ExtHTML5.text-level-semantics#the-data-element <data>}
019 * element.
020 *
021 * <ul class='seealso'>
022 *    <li class='link'>{@doc DtoHtml5}
023 * </ul>
024 */
025@Bean(typeName="data")
026public class Data extends HtmlElementMixed {
027
028   /**
029    * Creates an empty {@link Data} element.
030    */
031   public Data() {}
032
033   /**
034    * Creates a {@link Data} element with the specified {@link Data#value(Object)} attribute and child node.
035    *
036    * @param value The {@link Data#value(Object)} attribute.
037    * @param child The child node.
038    */
039   public Data(String value, Object child) {
040      value(value).child(child);
041   }
042
043   /**
044    * {@doc ExtHTML5.text-level-semantics#attr-data-value value}
045    * attribute.
046    *
047    * <p>
048    * Machine-readable value.
049    *
050    * @param value
051    *    The new value for this attribute.
052    *    Typically a {@link Number} or {@link String}.
053    * @return This object (for method chaining).
054    */
055   public final Data value(Object value) {
056      attr("value", value);
057      return this;
058   }
059
060
061   //-----------------------------------------------------------------------------------------------------------------
062   // Overridden methods
063   //-----------------------------------------------------------------------------------------------------------------
064
065   @Override /* HtmlElement */
066   public final Data _class(String _class) {
067      super._class(_class);
068      return this;
069   }
070
071   @Override /* HtmlElement */
072   public final Data id(String id) {
073      super.id(id);
074      return this;
075   }
076
077   @Override /* HtmlElement */
078   public final Data style(String style) {
079      super.style(style);
080      return this;
081   }
082
083   @Override /* HtmlElementMixed */
084   public Data children(Object...children) {
085      super.children(children);
086      return this;
087   }
088
089   @Override /* HtmlElementMixed */
090   public Data child(Object child) {
091      super.child(child);
092      return this;
093   }
094}