Class PropHelper

  • All Implemented Interfaces:

    
    public class PropHelper
    
                        
    Since:

    2022-06-17

    Author:

    trydofor

    • Constructor Detail

      • PropHelper

        PropHelper()
    • Method Detail

      • invalid

         static boolean invalid(String str)

        invalid if null/blank/DisabledValue/MaskingValue

      • valid

         static boolean valid(String value)

        true if not invalid

      • stringResource

        @Contract(value = "!null->!null") static String stringResource(Resource resource)

        Use 'classpath:' format for ClassPathResource and getURL().toExternalForm() for the rest

      • removeOptional

        @Contract(value = "_,!null->!null") static String removeOptional(@NotNull() String url, String elz)

        remove prefix `optional:`, return elz if no prefix

      • removeOptional

        @NotNull() static String removeOptional(@NotNull() String url)

        remove prefix `optional:`, return the input url if no prefix

      • resourceString

        @Nullable() static Resource resourceString(String url)

        `optional:` prefix will return null if exception. use ApplicationContext(if prepared) or DefaultResourceLoader as loader by default.

      • resourceString

        @Nullable() static Resource resourceString(String url, @NotNull() ResourceLoader resourceLoader)

        `optional:` prefix will return null if exception

      • commaString

        @Contract(value = "!null -> !null") static String commaString(Array<Object> items)

        parse comma-delimited-list string, no strip item, no drop

      • commaArray

        @NotNull() static Array<String> commaArray(String commaString)

        parse comma-delimited-list string, strip item, drop invalid

      • commaArray

        @NotNull() static Array<String> commaArray(String commaString, boolean strip, boolean drop)

        parse comma-delimited-list string, whether to strip item, whether to drop invalid

      • commaList

        @NotNull() static List<String> commaList(String commaString)

        parse comma-delimited-list string, strip item, drop invalid

      • commaList

        @NotNull() static List<String> commaList(String commaString, boolean strip, boolean drop)

        parse comma-delimited-list string, whether to strip item, whether to drop invalid

      • delimitedList

        @NotNull() static List<String> delimitedList(String delimitedString, String delimiter, boolean strip, boolean drop)

        parse delimiter(comma if empty) delimited-list string, whether to strip item, whether to drop invalid