Class ResourceUtil

java.lang.Object
com.adobe.acs.commons.util.ResourceUtil

@ProviderType public final class ResourceUtil extends Object
Utils for JCR resources.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    getPropertyBoolean(org.apache.sling.api.resource.Resource resource, String namePattern)
    Convenience method for getting a single-value boolean property from a resource.
    static Calendar
    getPropertyCalendar(org.apache.sling.api.resource.Resource resource, String namePattern)
    Convenience method for getting a single-value Calendar property from a resource.
    static Date
    getPropertyDate(org.apache.sling.api.resource.Resource resource, String namePattern)
    Convenience method for getting a single-value Date property from a resource.
    static BigDecimal
    getPropertyDecimal(org.apache.sling.api.resource.Resource resource, String namePattern)
    Conventience method for getting a single-value BigDecimal property from a resource.
    static Double
    getPropertyDouble(org.apache.sling.api.resource.Resource resource, String namePattern)
    Conventience method for getting a single-value Double property from a resource.
    static Long
    getPropertyLong(org.apache.sling.api.resource.Resource resource, String namePattern)
    Conventience method for getting a single-value Long property from a resource.
    static org.apache.sling.api.resource.Resource
    getPropertyReference(org.apache.sling.api.resource.Resource resource, String namePattern)
    Get a Resource from a path specified in a resource property.
    static String
    getPropertyString(org.apache.sling.api.resource.Resource resource, String namePattern)
    Convenience method for getting a single-value String property from a resource.
    static List<String>
    getPropertyStrings(org.apache.sling.api.resource.Resource resource, String namePattern)
    Convenience method for getting a multi-value String property from a resource.

    Methods inherited from class java.lang.Object

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

    • getPropertyBoolean

      public static boolean getPropertyBoolean(org.apache.sling.api.resource.Resource resource, String namePattern)
      Convenience method for getting a single-value boolean property from a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Property name.
      Returns:
      Property value if present, else false.
    • getPropertyCalendar

      public static Calendar getPropertyCalendar(org.apache.sling.api.resource.Resource resource, String namePattern)
      Convenience method for getting a single-value Calendar property from a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Property name.
      Returns:
      Property value.
    • getPropertyDate

      public static Date getPropertyDate(org.apache.sling.api.resource.Resource resource, String namePattern)
      Convenience method for getting a single-value Date property from a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Property name.
      Returns:
      Property value.
    • getPropertyDecimal

      public static BigDecimal getPropertyDecimal(org.apache.sling.api.resource.Resource resource, String namePattern)
      Conventience method for getting a single-value BigDecimal property from a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Property name.
      Returns:
      Property value.
    • getPropertyDouble

      public static Double getPropertyDouble(org.apache.sling.api.resource.Resource resource, String namePattern)
      Conventience method for getting a single-value Double property from a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Property name.
      Returns:
      Property value.
    • getPropertyLong

      public static Long getPropertyLong(org.apache.sling.api.resource.Resource resource, String namePattern)
      Conventience method for getting a single-value Long property from a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Property name.
      Returns:
      Property value.
    • getPropertyReference

      public static org.apache.sling.api.resource.Resource getPropertyReference(org.apache.sling.api.resource.Resource resource, String namePattern)
      Get a Resource from a path specified in a resource property. Returns null if the path cannot be resolved to a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Name of the property storing the resource path.
      Returns:
      The referenced resource.
    • getPropertyString

      public static String getPropertyString(org.apache.sling.api.resource.Resource resource, String namePattern)
      Convenience method for getting a single-value String property from a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Property name.
      Returns:
      Property value.
    • getPropertyStrings

      public static List<String> getPropertyStrings(org.apache.sling.api.resource.Resource resource, String namePattern)
      Convenience method for getting a multi-value String property from a resource.
      Parameters:
      resource - The resource from which to get the property.
      namePattern - Property name.
      Returns:
      Property values.