Class PropertyBagUtil


  • public final class PropertyBagUtil
    extends java.lang.Object
    Utility methods for dealing with property bags.
    Since:
    16.0.0
    Version:
    $Revision: 25808 $ $Date: 2023-07-04 15:20:55 -0300 (Tue, 04 Jul 2023) $
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T getOrDefault​(StructureElement structureElement, java.lang.String propertyName, T defaultValue, java.util.function.Function<java.lang.String,​T> convertFunction)
      Returns either the value defined in property bag of the given structure element or the default value.
      • Methods inherited from class java.lang.Object

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

      • getOrDefault

        public static <T> T getOrDefault​(StructureElement structureElement,
                                         java.lang.String propertyName,
                                         T defaultValue,
                                         java.util.function.Function<java.lang.String,​T> convertFunction)
                                  throws PortalException
        Returns either the value defined in property bag of the given structure element or the default value.
        Type Parameters:
        T -
        Parameters:
        structureElement - the structure element
        propertyName - the target property name
        defaultValue - the default value
        convertFunction - the function used to convert a string (property bag value) in the type T
        Returns:
        either the value defined in property bag of the given structure element or the default value
        Throws:
        PortalException
        Since:
        16.0.0