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.atom; 014 015import static org.apache.juneau.xml.annotation.XmlFormat.*; 016 017import org.apache.juneau.annotation.*; 018import org.apache.juneau.xml.annotation.*; 019 020/** 021 * Represents an <code>atomTextConstruct</code> construct in the RFC4287 specification. 022 * 023 * <h5 class='figure'>Schema</h5> 024 * <p class='bcode'> 025 * atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct 026 * 027 * atomPlainTextConstruct = 028 * atomCommonAttributes, 029 * attribute type { "text" | "html" }?, 030 * text 031 * 032 * atomXHTMLTextConstruct = 033 * atomCommonAttributes, 034 * attribute type { "xhtml" }, 035 * xhtmlDiv 036 * 037 * xhtmlDiv = element xhtml:div { 038 * (attribute * { text } 039 * | text 040 * | anyXHTML)* 041 * } 042 * </p> 043 * 044 * <h5 class='section'>See Also:</h5> 045 * <ul class='doctree'> 046 * <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.Atom'>Overview > juneau-dto > Atom</a> 047 * <li class='jp'><a class='doclink' href='package-summary.html#TOC'>org.apache.juneau.dto.atom</a> 048 * </ul> 049 */ 050public class Text extends Common { 051 052 private String type; 053 private String text; 054 055 /** 056 * Normal content. 057 * 058 * @param type The content type of this content. 059 */ 060 public Text(String type) { 061 type(type); 062 } 063 064 /** Bean constructor. */ 065 public Text() {} 066 067 068 //-------------------------------------------------------------------------------- 069 // Bean properties 070 //-------------------------------------------------------------------------------- 071 072 /** 073 * Returns the content type of this content. 074 * 075 * @return The content type of this content. 076 */ 077 @Xml(format=ATTR) 078 public String getType() { 079 return type; 080 } 081 082 /** 083 * Sets the content type of this content. 084 * 085 * <p> 086 * Must be one of the following: 087 * <ul> 088 * <li><js>"text"</js> 089 * <li><js>"html"</js> 090 * <li><js>"xhtml"</js> 091 * <li><jk>null</jk> (defaults to <js>"text"</js>) 092 * </ul> 093 * 094 * @param type The content type of this content. 095 * @return This object (for method chaining). 096 */ 097 @BeanProperty("type") 098 public Text type(String type) { 099 this.type = type; 100 return this; 101 } 102 103 /** 104 * Returns the content of this content. 105 * 106 * @return The content of this content. 107 */ 108 @Xml(format=XMLTEXT) 109 public String getText() { 110 return text; 111 } 112 113 /** 114 * Sets the content of this content. 115 * 116 * @param text The content of this content. 117 * @return This object (for method chaining). 118 */ 119 @BeanProperty("text") 120 public Text text(String text) { 121 this.text = text; 122 return this; 123 } 124 125 126 //-------------------------------------------------------------------------------- 127 // Overridden setters (to simplify method chaining) 128 //-------------------------------------------------------------------------------- 129 130 @Override /* Common */ 131 public Text base(Object base) { 132 super.base(base); 133 return this; 134 } 135 136 @Override /* Common */ 137 public Text lang(String lang) { 138 super.lang(lang); 139 return this; 140 } 141}