/** * Creates a primitive list based on an input list and a property path * * @param inputList input list * @param propertyPath property path * @return primitive list */ public static DoubleList toDoubleList(Collection<?> inputList, String propertyPath) { if (inputList.size() == 0) { return new DoubleList(0); } DoubleList outputList = new DoubleList(inputList.size()); if (propertyPath.contains(".") || propertyPath.contains("[")) { String[] properties = StringScanner.splitByDelimiters(propertyPath, ".[]"); for (Object o : inputList) { outputList.add(BeanUtils.getPropertyDouble(o, properties)); } } else { Map<String, FieldAccess> fields = BeanUtils.getFieldsFromObject(inputList.iterator().next()); FieldAccess fieldAccess = fields.get(propertyPath); for (Object o : inputList) { outputList.add(fieldAccess.getDouble(o)); } } return outputList; }
public static double getPropertyDouble( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toDouble(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.dbl ) { return field.getDouble( object ); } else { return Conversions.toDouble( field.getValue( object ) ); } }
public static double getPropertyDouble( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toDouble(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.dbl ) { return field.getDouble( object ); } else { return Conversions.toDouble( field.getValue( object ) ); } }
double dvalue = fieldAccess.getDouble ( parent ); if (includeDefault || include || dvalue != 0 ) { serializeFieldName ( fieldName, builder );
double dvalue = fieldAccess.getDouble ( parent ); if (includeDefault || include || dvalue != 0 ) { serializeFieldName ( fieldName, builder );
double dvalue = fieldAccess.getDouble ( parent ); if (includeDefault || include || dvalue != 0 ) { serializeFieldName ( fieldName, builder );
double dvalue = fieldAccess.getDouble ( parent ); if ( dvalue != 0 ) { serializeFieldName ( fieldName, builder );
double dvalue = fieldAccess.getDouble ( parent ); if ( dvalue != 0 ) { serializeFieldName ( fieldName, builder );
double dvalue = fieldAccess.getDouble ( parent ); if ( dvalue != 0 ) { serializeFieldName ( fieldName, builder );
double dvalue = fieldAccess.getDouble ( parent ); if ( dvalue != 0 ) { serializeFieldName ( fieldName, builder );
double dvalue = fieldAccess.getDouble ( parent ); if ( dvalue != 0 ) { serializeFieldName ( fieldName, builder );
double dvalue = fieldAccess.getDouble ( parent ); if ( dvalue != 0 ) { serializeFieldName ( fieldName, builder );