Java Properties Get getSubProperties(Properties src, String prefix)

Here you can find the source of getSubProperties(Properties src, String prefix)

Description

get Sub Properties

License

Apache License

Declaration

public static Properties getSubProperties(Properties src, String prefix) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static Properties getSubProperties(Properties src, String prefix) {
        Properties persistenceProps = new Properties();
        for (String key : src.stringPropertyNames()) {
            if (key.startsWith(prefix)) {
                String value = src.getProperty(key);
                persistenceProps.setProperty(key, value);
            }//from  w  w w.java  2  s. c  o  m
        }
        return persistenceProps;
    }
}

Related

  1. getString(Properties props, String key)
  2. getString(Properties props, String name)
  3. getString(Properties props, String name, String defaultValue)
  4. getStringConfigValue( final String configKey, final Properties config)
  5. getStringConfigVaule(Properties properties, String key, String defaultValue)
  6. getValue(Properties properties, String key)