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 org.apache.juneau.commons.bean.*; 020import org.apache.juneau.marshall.xml.*; 021 022/** 023 * A subclass of HTML elements that contain <a href="https://www.w3.org/TR/html51/syntax.html#raw-text">raw text</a> 024 * only. 025 * 026 * <h5 class='section'>See Also:</h5><ul> 027 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 028 * </ul> 029 * 030 * @param <SELF> The self type for fluent setters. 031 */ 032@SuppressWarnings({ 033 "java:S119" // 'SELF' (CRTP self-type) is intentional and clearer than a single-letter name. 034}) 035public abstract class HtmlElementRawText<SELF extends HtmlElementRawText<SELF>> extends HtmlElement<SELF> { 036 037 private Object text; 038 039 /** 040 * Returns the inner text of this element. 041 * 042 * @return The inner text of this element, or <jk>null</jk> if no text is set. 043 */ 044 @Xml(format = XmlFormat.TEXT_PWS) 045 @BeanProp("c") 046 public Object getText() { return text; } 047 048 /** 049 * Sets the inner text of this element. 050 * 051 * @param text The inner text of this element, or <jk>null</jk> if no text is set. 052 * @return This object. 053 */ 054 @BeanProp("c") 055 public SELF setText(Object text) { 056 this.text = text; 057 return self(); 058 } 059 060 /** 061 * Sets the text node on this element. 062 * 063 * @param value The text node to add to this element. Can be <jk>null</jk> to leave the text unset. 064 * @return This object. 065 */ 066 public SELF text(Object value) { 067 text = value; 068 return self(); 069 } 070}