/jaxrs/providers/resteasy-atom/src/main/java/org/jboss/resteasy/plugins/providers/atom/app/AppCategories.java

https://bitbucket.org/cprenzberg/resteasy · Java · 173 lines · 66 code · 15 blank · 92 comment · 2 complexity · 1621e7c8359bf48ce47f46afdc972cc7 MD5 · raw file

  1. /*
  2. * Licensed under the Apache License, Version 2.0 (the "License");
  3. * you may not use this file except in compliance with the License.
  4. * You may obtain a copy of the License at
  5. *
  6. * http://www.apache.org/licenses/LICENSE-2.0
  7. *
  8. * Unless required by applicable law or agreed to in writing, software
  9. * distributed under the License is distributed on an "AS IS" BASIS,
  10. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. * See the License for the specific language governing permissions and
  12. * limitations under the License.
  13. *
  14. */
  15. package org.jboss.resteasy.plugins.providers.atom.app;
  16. import org.jboss.resteasy.plugins.providers.atom.Category;
  17. import javax.xml.bind.annotation.XmlAccessType;
  18. import javax.xml.bind.annotation.XmlAccessorType;
  19. import javax.xml.bind.annotation.XmlAttribute;
  20. import javax.xml.bind.annotation.XmlElement;
  21. import javax.xml.bind.annotation.XmlElements;
  22. import javax.xml.bind.annotation.XmlRootElement;
  23. import javax.xml.bind.annotation.XmlSchemaType;
  24. import javax.xml.bind.annotation.XmlType;
  25. import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  26. import java.util.ArrayList;
  27. import java.util.List;
  28. /**
  29. * The app:categories element can contain a "fixed" attribute, with a value of
  30. * either "yes" or "no", indicating whether the list of categories is a fixed or
  31. * an open set. The absence of the "fixed" attribute is equivalent to the
  32. * presence of a "fixed" attribute with a value of "no".
  33. *
  34. * Alternatively, the app:categories element MAY contain an "href" attribute,
  35. * whose value MUST be an IRI reference identifying a Category Document. If the
  36. * "href" attribute is provided, the app: categories element MUST be empty and
  37. * MUST NOT have the "fixed" or "scheme" attributes.
  38. *
  39. * @author <a href="mailto:kurt.stam@gmail.com">Kurt Stam</a>
  40. * @version $Revision: 1 $
  41. */
  42. @XmlRootElement(name = "categories")
  43. @XmlAccessorType(XmlAccessType.FIELD)
  44. @XmlType(name = "categories", propOrder = {
  45. "category", "href"
  46. })
  47. public class AppCategories extends AppCommonAttributes {
  48. private static final long serialVersionUID = 7978145545675525082L;
  49. @XmlElements({
  50. @XmlElement(name = "category", namespace = "http://www.w3.org/2005/Atom", type = Category.class)
  51. })
  52. protected List<Category> category;
  53. @XmlJavaTypeAdapter( BooleanAdapter.class )
  54. @XmlAttribute
  55. protected Boolean fixed;
  56. @XmlAttribute
  57. @XmlSchemaType(name = "anyURI")
  58. protected String scheme;
  59. @XmlSchemaType(name = "anyURI")
  60. protected String href;
  61. public AppCategories() {}
  62. public AppCategories(List<Category> category, Boolean fixed, String scheme,
  63. String href) {
  64. super();
  65. this.category = category;
  66. this.fixed = fixed;
  67. this.scheme = scheme;
  68. this.href = href;
  69. }
  70. /**
  71. * Gets the value of the category property.
  72. *
  73. * <p>
  74. * This accessor method returns a reference to the live list,
  75. * not a snapshot. Therefore any modification you make to the
  76. * returned list will be present inside the JAXB object.
  77. * This is why there is not a <CODE>set</CODE> method for the category property.
  78. *
  79. * <p>
  80. * For example, to add a new item, do as follows:
  81. * <pre>
  82. * getCategory().add(newItem);
  83. * </pre>
  84. *
  85. *
  86. * <p>
  87. * Objects of the following type(s) are allowed in the list
  88. * {@link AppCategoryType }
  89. *
  90. *
  91. */
  92. public List<Category> getCategory() {
  93. if (category == null) {
  94. category = new ArrayList<Category>();
  95. }
  96. return this.category;
  97. }
  98. /**
  99. * Gets the value of the fixed property.
  100. *
  101. * @return
  102. * possible object is
  103. * {@link Boolean }
  104. *
  105. */
  106. public Boolean isFixed() {
  107. return fixed;
  108. }
  109. /**
  110. * Sets the value of the fixed property.
  111. *
  112. * @param value
  113. * allowed object is
  114. * {@link Boolean }
  115. *
  116. */
  117. public void setFixed(Boolean value) {
  118. this.fixed = value;
  119. }
  120. /**
  121. * Gets the value of the scheme property.
  122. *
  123. * @return possible object is {@link String }
  124. *
  125. */
  126. public String getScheme() {
  127. return scheme;
  128. }
  129. /**
  130. * Sets the value of the scheme property.
  131. *
  132. * @param value
  133. * allowed object is {@link String }
  134. *
  135. */
  136. public void setScheme(String value) {
  137. this.scheme = value;
  138. }
  139. /**
  140. * Gets the value of the href property.
  141. *
  142. * @return possible object is {@link String }
  143. *
  144. */
  145. public String getHref() {
  146. return href;
  147. }
  148. /**
  149. * Sets the value of the href property.
  150. *
  151. * @param value
  152. * allowed object is {@link String }
  153. *
  154. */
  155. public void setHref(String value) {
  156. this.href = value;
  157. }
  158. }