Java Properties Get getBoolean(Properties props, String key)

Here you can find the source of getBoolean(Properties props, String key)

Description

get Boolean

License

Apache License

Declaration

public static boolean getBoolean(Properties props, String key) 

Method Source Code

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

import java.util.*;

public class Main {

    public static boolean getBoolean(Properties props, String key) {
        return getBoolean(props, key, false);
    }/*from  w  w  w .  j  a  v a2s.co m*/

    public static boolean getBoolean(Properties props, String key,
            boolean defalutValue) {
        boolean value = defalutValue;
        if (props.containsKey(key)) {
            String vauleStr = props.getProperty(key).trim();
            if (vauleStr.equals("true") || vauleStr.equals("false")) {
                value = Boolean.parseBoolean(vauleStr);
            }
        }
        return value;
    }
}

Related

  1. clearPrefixedSystemProperties(String prefix, Map targetPropertyMap)
  2. copyProperties(Hashtable src, Hashtable target)
  3. getBoolean(Properties props, String name, boolean defaultValue)
  4. getInt(Properties props, String name)
  5. getInt(Properties props, String name, int defaultValue)
  6. getIntersectionOfPropertyValues(Properties propertyFileOne, Properties propertyFileTwo)