net.loginbuddy.config/src/main/java/net/loginbuddy/config/loginbuddy/LoginbuddyUtil.java
/**
     * Updates the current list of providers with the given updated values.
     * @param providersAsJsonString the JSON list of providers to replace the existing ones.
     * @return
     * @throws IllegalArgumentException
     */
Updates the current list of providers with the given updated values.
@param providersAsJsonString the JSON list of providers to replace the existing ones.
Updates the current list of providers with the given updated values . @param providersAsJsonString the JSON list of providers to replace the existing ones .
public List<Providers> updateProviders(String providersAsJsonString) throws IllegalArgumentException {
        try {
            List<Providers> newProviders = new ArrayList<>();
            if(providersAsJsonString.startsWith("[")) {
                newProviders.addAll(Arrays.asList(MAPPER.readValue(providersAsJsonString, Providers[].class)));
            } else {
                newProviders.add(MAPPER.readValue(providersAsJsonString, Providers.class));
            }
            return loader.update(newProviders);
        } catch(Exception e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }
public List < Providers > updateProviders ( String providersAsJsonString ) throws IllegalArgumentException { try { List < Providers > newProviders = new ArrayList < > ( ) ; if ( providersAsJsonString . startsWith ( "[" ) ) { newProviders . addAll ( Arrays . asList ( MAPPER . readValue ( providersAsJsonString , Providers [ ] . class ) ) ) ; } else { newProviders . add ( MAPPER . readValue ( providersAsJsonString , Providers . class ) ) ; } return loader . update ( newProviders ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; } }
Updates the current list of providers with the given updated values.
Updates the current list of providers with the given updated values .