Class Facet

java.lang.Object
edu.byu.hbll.box.Facet
All Implemented Interfaces:
Serializable

public final class Facet extends Object implements Serializable
Represents a facet. Immutable.
Author:
Charles Draper
See Also:
  • Constructor Details

    • Facet

      public Facet(String name, String value)
      Creates a new Facet with the given name and value.
      Parameters:
      name - name of the facet group
      value - value of the facet
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • validateName

      public static String validateName(String name)
      Validates a facet group name. Facet names must contain only characters in [0-9A-Za-z_].
      Parameters:
      name - name of the facet group
      Returns:
      whether or not the name is valid
    • parse

      public static Facet parse(String facet)
      Parses a facet value in the form of "NAME:VALUE".
      Parameters:
      facet - the facet value
      Returns:
      the parsed facet
    • parse

      public static List<Facet> parse(Collection<String> facets)
      Parses facet values in the form of "NAME:VALUE".
      Parameters:
      facets - the facets to parse
      Returns:
      the parsed facets
    • group

      public static Map<String,Set<Facet>> group(Collection<Facet> facets)
      Utility method for grouping facets by name.
      Parameters:
      facets - a collection of facets
      Returns:
      a map of group name to a set of corresponding facets
    • getName

      public String getName()
      Returns the name of the facet.
      Returns:
      the name of the facet
    • getValue

      public String getValue()
      Returns the value of the facet.
      Returns:
      the value of the facet.