/** * Gets the value of a String property. * * @param property The Property to get. * @return The property value or default value, if no such is defined in the base Properties. * @throws ConfigurationException When the given property name does not exist within the current component and the property * does not have a default value set. */ public String get(Property<String> property) throws ConfigurationException { return tryGet(property, s -> s); }
/** * Gets the value of a Long property. * * @param property The Property to get. * @return The property value or default value, if no such is defined in the base Properties. * @throws ConfigurationException When the given property name does not exist within the current component and the property * does not have a default value set, or when the property cannot be parsed as a Long. */ public long getLong(Property<Long> property) throws ConfigurationException { return tryGet(property, Long::parseLong); }
/** * Gets the value of an Integer property. * * @param property The Property to get. * @return The property value or default value, if no such is defined in the base Properties. * @throws ConfigurationException When the given property name does not exist within the current component and the property * does not have a default value set, or when the property cannot be parsed as an Integer. */ public int getInt(Property<Integer> property) throws ConfigurationException { return tryGet(property, Integer::parseInt); }
/** * Gets the value of a boolean property. * Notes: * <ul> * <li> "true", "yes" and "1" (case insensitive) map to boolean "true". * <li> "false", "no" and "0" (case insensitive) map to boolean "false". * </ul> * * @param property The Property to get. * @return The property value or default value, if no such is defined in the base Properties. * @throws ConfigurationException When the given property name does not exist within the current component and the property * does not have a default value set, or when the property cannot be parsed as a Boolean. */ public boolean getBoolean(Property<Boolean> property) throws ConfigurationException { return tryGet(property, this::parseBoolean); }
/** * Gets the value of an Enumeration property. * * @param property The Property to get. * @param enumClass Class defining return type. * @param <T> Type of Enumeration. * @return The property value or default value, if no such is defined in the base Properties. * @throws ConfigurationException When the given property name does not exist within the current component and the property * does not have a default value set, or when the property cannot be parsed as the given Enum. */ public <T extends Enum<T>> T getEnum(Property<T> property, Class<T> enumClass) throws ConfigurationException { return tryGet(property, s -> Enum.valueOf(enumClass, s)); }