org.apache.commons.beanutils.converters.AbstractConverter Java Examples
The following examples show how to use
org.apache.commons.beanutils.converters.AbstractConverter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FieldHolder.java From bluetooth-gatt-parser with Apache License 2.0 | 5 votes |
private AbstractConverter getConverter() { FieldFormat fieldFormat = field.getFormat(); int size = fieldFormat.getSize(); switch (fieldFormat.getType()) { case BOOLEAN: return new BooleanConverter(); case UINT: if (size < 32) { return new IntegerConverter(); } else if (size < 64) { return new LongConverter(); } else { return new BigIntegerConverter(); } case SINT: if (size <= 32) { return new IntegerConverter(); } else if (size <= 64) { return new LongConverter(); } else { return new BigIntegerConverter(); } case FLOAT_IEE754: case FLOAT_IEE11073: return size <= 32 ? new FloatConverter() : new DoubleConverter(); case UTF8S: case UTF16S: return new StringConverter(); default: throw new IllegalStateException("Unsupported field format: " + fieldFormat.getType()); } }