Class EntityExpansionUtil

java.lang.Object
com.atlassian.crowd.plugin.rest.util.EntityExpansionUtil

public class EntityExpansionUtil extends Object
Utility class for entity expansion.
Since:
v2.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Name of the expand query parameter.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.atlassian.plugins.rest.api.expand.parameter.ExpandParameter
    getExpandParameter(javax.servlet.http.HttpServletRequest request)
    Returns a ExpandParameter representing the expand query parameter from an HttpServletRequest.
    static boolean
    shouldExpandField(Class clazz, String fieldName, com.atlassian.plugins.rest.api.expand.parameter.ExpandParameter expandParameter)
    Returns whether a field of the specified entity class should be expanded.
    static boolean
    shouldExpandField(Class clazz, String fieldName, javax.servlet.http.HttpServletRequest request)
    Returns whether a field of the specified entity class should be expanded.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • shouldExpandField

      public static boolean shouldExpandField(Class clazz, String fieldName, javax.servlet.http.HttpServletRequest request)
      Returns whether a field of the specified entity class should be expanded.

      E.g. a client may perform a request to /user?expand=attributes which instructs the server to expand the attributes field of the user entity.

      Parameters:
      clazz - the class of the field to check for expansion.
      fieldName - name of the field to check for expansion.
      request - HttpServletRequest to extract the expand query param from.
      Returns:
      true if the field should be expanded, otherwise false.
    • shouldExpandField

      public static boolean shouldExpandField(Class clazz, String fieldName, com.atlassian.plugins.rest.api.expand.parameter.ExpandParameter expandParameter)
      Returns whether a field of the specified entity class should be expanded. See shouldExpandField(Class, String, HttpServletRequest) to extract the expand query parameter from a HttpServletRequest.
      Parameters:
      clazz - the class of the field to check for expansion.
      fieldName - name of the field to check for expansion.
      expandParameter - ExpandParameter to check for expansion.
      Returns:
      true if the field should be expanded, otherwise false.
      Throws:
      IllegalArgumentException - if the field name could not be found in the class.
    • getExpandParameter

      public static com.atlassian.plugins.rest.api.expand.parameter.ExpandParameter getExpandParameter(javax.servlet.http.HttpServletRequest request)
      Returns a ExpandParameter representing the expand query parameter from an HttpServletRequest.
      Parameters:
      request - HttpServletRequest.
      Returns:
      ExpandParameter representing the expand query parameter.