List of usage examples for org.apache.commons.configuration Configuration getFloat
Float getFloat(String key, Float defaultValue);
From source file:openlr.properties.OpenLRPropertyAccess.java
/** * Gets the float property value.//from w ww. ja v a2 s . c o m * * @param properties * the properties * @param property * the property * @return the float property value * @throws OpenLRPropertyException * the open lr property exception */ public static float getFloatPropertyValue(final Configuration properties, final OpenLRProperty property) throws OpenLRPropertyException { if (property.getPropertyType() != PropertyType.FLOAT) { String error = property.getKey() + " is not a float"; LOG.error(error); throw new OpenLRPropertyException(PropertyError.INVALID_PROPERTY_TYPE, error); } if (properties == null) { return (Float) property.getDefault(); } return properties.getFloat(property.getKey(), (Float) property.getDefault()); }
From source file:org.apache.whirr.InstanceTemplate.java
private static void parseInstanceTemplateGroupOverrides(Configuration configuration, String templateGroup, Builder templateBuilder) {//from w ww. j a v a 2 s . c o m String hardwareId = configuration.getString("whirr.templates." + templateGroup + ".hardware-id", null); String imageId = configuration.getString("whirr.templates." + templateGroup + ".image-id", null); float awsEc2SpotPrice = configuration.getFloat("whirr.templates." + templateGroup + ".aws-ec2-spot-price", 0); templateBuilder.hardwareId(hardwareId).imageId(imageId).awsEc2SpotPrice(awsEc2SpotPrice); }
From source file:org.j2free.cache.impl.memory.MemoryFragmentCache.java
/** * * @param config//from w w w . j a v a2s. c o m */ public MemoryFragmentCache(Configuration config) { this(config.getInt(PROP_SIZE, DEFAULT_SIZE), config.getFloat(PROP_LOAD_FACTOR, DEFAULT_LOAD_FACTOR), config.getInt(PROP_CONCURRENCY, DEFAULT_CONCURRENCY)); scheduleCleaner(config.getInt(PROP_CLEAN_INTERVAL), TimeUnit.SECONDS, false); }