001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.bean.html5;
018
019import static org.apache.juneau.xml.annotation.XmlFormat.*;
020
021import org.apache.juneau.xml.annotation.*;
022
023/**
024 * An object that gets serialized as raw XML by the XML and HTML serializers.
025 *
026 * <p>
027 * Can be used to serialize text containing markup without escaping the markup.
028 * For example:
029 *
030 * <h5 class='figure'>Example:</h5>
031 * <p class='bjava'>
032 *    HtmlText <jv>htmlText</jv> = <jk>new</jk> HtmlText(<js>"&lt;span&gt;&amp;#2753;&lt;/span&gt;"</js>);
033 * </p>
034 *
035 * <h5 class='section'>See Also:</h5><ul>
036 * </ul>
037 */
038@Xml(format=XMLTEXT)
039public class HtmlText {
040   private final String text;
041
042   /**
043    * Constructor.
044    *
045    * @param text Raw text.
046    */
047   public HtmlText(String text) {
048      this.text = text;
049   }
050
051   @Override
052   public String toString() {
053      return text;
054   }
055}