Class PropertyReader


  • public class PropertyReader
    extends Object
    Common methods to use to read properties.
    • Method Detail

      • getStringParam

        public static Optional<String> getStringParam​(org.wso2.carbon.module.core.SimpleMessageContext mc,
                                                      String parameterKey)
        Read a String parameter
        Parameters:
        mc - SimpleMessageContext.
        parameterKey - Key of the parameter.
        Returns:
        Optional String of the parameter value.
      • getCharParam

        public static Optional<Character> getCharParam​(org.wso2.carbon.module.core.SimpleMessageContext mc,
                                                       String parameterKey)
        Read a Character parameter.
        Parameters:
        mc - SimpleMessageContext.
        parameterKey - Key of the parameter.
        Returns:
        Optional Character of the parameter value.
      • getIntegerParam

        public static Optional<Integer> getIntegerParam​(org.wso2.carbon.module.core.SimpleMessageContext mc,
                                                        String parameterKey)
        Read an Integer parameter.
        Parameters:
        mc - SimpleMessageContext.
        parameterKey - Key of the parameter.
        Returns:
        Optional Integer of the parameter value.
      • getBooleanParam

        public static boolean getBooleanParam​(org.wso2.carbon.module.core.SimpleMessageContext mc,
                                              String parameterKey)
        Read a boolean parameter.
        Parameters:
        mc - SimpleMessageContext.
        parameterKey - Key of the parameter.
        Returns:
        Boolean of the parameter value.
      • getEnumParam

        public static <E extends Enum<E>> E getEnumParam​(org.wso2.carbon.module.core.SimpleMessageContext mc,
                                                         String parameterKey,
                                                         Class<E> enumType,
                                                         E defaultValue)
        Read an Enum parameter.
        Type Parameters:
        E - Enum type.
        Parameters:
        mc - SimpleMessageContext.
        parameterKey - Key of the parameter.
        enumType - Type of the enum.
        defaultValue - Default value of the enum.
        Returns:
        Enum value for the parameter value.
      • getJsonArrayParam

        public static <E> List<E> getJsonArrayParam​(org.wso2.carbon.module.core.SimpleMessageContext mc,
                                                    String parameterKey,
                                                    Class<E> type)
        Read JSON array parameter.
        Type Parameters:
        E - JSON Object type.
        Parameters:
        mc - SimpleMessageContext.
        parameterKey - Key of the parameter.
        type - JSON object type.
        Returns:
        List of JSON Objects of the parameter value.