Class Category

java.lang.Object
org.apache.juneau.bean.atom.Common
org.apache.juneau.bean.atom.Category

@Bean(typeName="category") public class Category extends Common
Represents a category or tag associated with a feed or entry.

Categories provide a way to classify or tag feeds and entries, enabling better organization and discovery of content. Each category has a term (required) and optionally a scheme (for namespacing) and a human-readable label.

Categories are commonly used for:

  • Tagging entries by topic (e.g., "technology", "sports")
  • Classifying content by category schemes (e.g., subject taxonomies)
  • Enabling feed filtering and organization
Schema

atomCategory = element atom:category { atomCommonAttributes, attribute term { text }, attribute scheme { atomUri }?, attribute label { text }?, undefinedContent }

Example:

// Simple category Category cat1 = new Category("technology"); // Category with scheme and label Category cat2 = new Category("tech") .setScheme("http://example.org/categories") .setLabel("Technology"); // Add to entry Entry entry = new Entry(...) .setCategories(cat1, cat2);

Specification:

Represents an atomCategory construct in the RFC 4287 - Section 4.2.2 specification.

See Also:
  • Constructor Details

    • Category

      public Category(String term)
      Normal constructor.
      Parameters:
      term - The category term.
    • Category

      public Category()
      Bean constructor.
  • Method Details

    • getTerm

      Bean property getter: term.

      The category term.

      Returns:
      The property value, or null if it is not set.
    • setTerm

      Bean property setter: term.

      The category term.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • getScheme

      Bean property getter: scheme.

      The category scheme.

      Returns:
      The property value, or null if it is not set.
    • setScheme

      public Category setScheme(Object value)
      Bean property setter: scheme.

      The category scheme.

      The value can be of any of the following types: URI, URL, String. Strings must be valid URIs.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • getLabel

      Bean property getter: label.

      The category label.

      Returns:
      The property value, or null if it is not set.
    • setLabel

      public Category setLabel(String value)
      Bean property setter: scheme.

      The category label.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setBase

      public Category setBase(Object value)
      Description copied from class: Common
      Bean property setter: base.

      Sets the base URI for resolving relative URI references (xml:base attribute).

      The value can be of any of the following types: URI, URL, String. Strings must be valid URIs.

      Example:

      Feed feed = new Feed(...) .setBase("http://example.org/");

      Overrides:
      setBase in class Common
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • setLang

      public Category setLang(String value)
      Description copied from class: Common
      Bean property setter: lang.

      Sets the natural language of the element's content (xml:lang attribute).

      Example:

      Text title = new Text("text") .setText("Mon Blog") .setLang("fr");

      Overrides:
      setLang in class Common
      Parameters:
      value - The new value for this property (e.g., "en", "fr", "de", "en-US").
      Can be null to unset the property.
      Returns:
      This object.