Java Code Examples for org.apache.commons.lang3.math.NumberUtils.createNumber()

The following are Jave code examples for showing how to use createNumber() of the org.apache.commons.lang3.math.NumberUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ClientAPI   File: NumberParser.java   View Source Code Vote up 5 votes
@Override
public final Number parse(ExecutionContext context, Type type, String raw) {
    if (NumberUtils.isCreatable(raw)) {
        return NumberUtils.createNumber(raw);
    }
    return null;
}
 
Example 2
Project: VISNode   File: ProcessNode.java   View Source Code Vote up 5 votes
/**
 * Sets the default input value
 *
 * @param meta
 * @param param
 */
private void dafaultInput(ProcessMetadata meta, NodeParameter param) {
    if (meta.getDefault(param.getName()) != null) {
        TypeConverter converter = new TypeConverter();
        Object value;
        try {
            value = NumberUtils.createNumber(meta.getDefault(param.getName()));
        } catch (NumberFormatException ex) {
            value = meta.getDefault(param.getName());
        }
        this.input.put(param.getName(), converter.convert(value, param.getType()));
    }
}