Package com.adobe.acs.commons.util
Class ResourceUtil
java.lang.Object
com.adobe.acs.commons.util.ResourceUtil
Utils for JCR resources.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleangetPropertyBoolean(org.apache.sling.api.resource.Resource resource, String namePattern) Convenience method for getting a single-value boolean property from a resource.static CalendargetPropertyCalendar(org.apache.sling.api.resource.Resource resource, String namePattern) Convenience method for getting a single-value Calendar property from a resource.static DategetPropertyDate(org.apache.sling.api.resource.Resource resource, String namePattern) Convenience method for getting a single-value Date property from a resource.static BigDecimalgetPropertyDecimal(org.apache.sling.api.resource.Resource resource, String namePattern) Conventience method for getting a single-value BigDecimal property from a resource.static DoublegetPropertyDouble(org.apache.sling.api.resource.Resource resource, String namePattern) Conventience method for getting a single-value Double property from a resource.static LonggetPropertyLong(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.ResourcegetPropertyReference(org.apache.sling.api.resource.Resource resource, String namePattern) Get a Resource from a path specified in a resource property.static StringgetPropertyString(org.apache.sling.api.resource.Resource resource, String namePattern) Convenience method for getting a single-value String property from a resource.getPropertyStrings(org.apache.sling.api.resource.Resource resource, String namePattern) Convenience method for getting a multi-value String property from a resource.
-
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.
-