Get an attribute converted to a float value

@param attribute The attribute to retrieve
@return The float value derived from the attribute
178594
public float getAsFloat(String attribute) {
		String value = getAttribute(attribute);
		if (value == null) {
			return 0;
		}
		
		try {
			return Float.parseFloat(value);
		} catch (NumberFormatException e) {
			throw new RuntimeException("Attribute "+attribute+" is not specified as a float:"+getAttribute(attribute));			
		}
	}
330680
public List<String> getAttributeAsArray(AnnotationAttributeType attribute) {
		String temp = attributes.get(attribute.getValue());

		return AnnotationUtility.extractAsArrayOfString(temp);
	}
13134
public Float getAsNullableFloat(String key) {
		Object value = getAsObject(key);
		return FloatConverter.toNullableFloat(value);
	}
469435
public Float getFloat(String fieldName) {
		try {
			return hasValue(fieldName) ? Float.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
		} catch (NumberFormatException e) {
			throw new FqlException("Field '" + fieldName +"' is not a number.", e);
		}
	}
768659
public final int getAttributeValueAsInteger(String attributeName) {
    Attribute attribute = getAttribute(attributeName);
    if (attribute == null) {
      return 0;
    }
    else {
      try {
        return attribute.getIntValue();
      }
      catch (DataConversionException ex) {
        return 0;
      }
    }
  }
610408
public static float toFloat(final Object value) {
		if (value instanceof Float) {
			return (float) value;
		}
		if (value == null) {
			return 0;
		}
		return new Float(value.toString());
	}
60622
@SuppressWarnings("unchecked")
    public <T> T getAttribute( String attrName, Class<T> adaptee ) {
        if (attrName == null) {
            return null;
        }
        if (adaptee == null) {
            adaptee = (Class<T>) String.class;
        }

        Object attribute = feature.getAttribute(attrName);
        if (attribute == null) {
            return null;
        }
        if (attribute instanceof Number) {
            Number num = (Number) attribute;
            if (adaptee.isAssignableFrom(Double.class)) {
                return adaptee.cast(num.doubleValue());
            } else if (adaptee.isAssignableFrom(Float.class)) {
                return adaptee.cast(num.floatValue());
            } else if (adaptee.isAssignableFrom(Integer.class)) {
                return adaptee.cast(num.intValue());
            } else if (adaptee.isAssignableFrom(Long.class)) {
                return adaptee.cast(num.longValue());
            } else if (adaptee.isAssignableFrom(String.class)) {
                return adaptee.cast(num.toString());
            } else {
                throw new IllegalArgumentException();
            }
        } else if (attribute instanceof String) {
            if (adaptee.isAssignableFrom(Double.class)) {
                try {
                    Double parsed = Double.parseDouble((String) attribute);
                    return adaptee.cast(parsed);
                } catch (Exception e) {
                    return null;
                }
            } else if (adaptee.isAssignableFrom(Float.class)) {
                try {
                    Float parsed = Float.parseFloat((String) attribute);
                    return adaptee.cast(parsed);
                } catch (Exception e) {
                    return null;
                }
            } else if (adaptee.isAssignableFrom(Integer.class)) {
                try {
                    Integer parsed = Integer.parseInt((String) attribute);
                    return adaptee.cast(parsed);
                } catch (Exception e) {
                    return null;
                }
            } else if (adaptee.isAssignableFrom(String.class)) {
                return adaptee.cast(attribute);
            } else {
                throw new IllegalArgumentException();
            }
        } else if (attribute instanceof Geometry) {
            return null;
        } else {
            throw new IllegalArgumentException("Can't adapt attribute of type: " + attribute.getClass().getCanonicalName());
        }
    }
869142
public Bindings getBindings(String attribute) {
	if (_bindings == null || attribute == null) return null;
	return (Bindings)_bindings.get(canonicalize(attribute));
    }
297614
public Double getDoubleObject(String attributeName) {
        String val = get(attributeName, null);
        if (val != null) {
            return Double.valueOf(val);
        }
        return null;
    }
775554
public PropertyState getState(Attribute<E, ?> attribute) {
        if (stateless) {
            return null;
        }
        PropertyState state = attribute.getPropertyState().get(entity);
        return state == null ? PropertyState.FETCH : state;
    }
171989
public float getFloat(int key)
    {
        Object value = map.get(key);
        if (!(value instanceof Float))
        {
            return 0.0f;
        }
        Float result = (Float)value;
        return result;
    }
156251
@SuppressWarnings("unchecked")
    public <T> T attribute(String attribute) {
        return (T) servletRequest.getAttribute(attribute);
    }
120317
public String getAttribute(String attributeName) {
		if (attributeName != null){
			return this.attributes.get(attributeName);
		}
		
		return null;
	}
700470
public static Long getLong(final LdapEntry ctx, final String attribute) {
        return getLong(ctx, attribute, Long.MIN_VALUE);
    }
912748
@Override
    public float getFloatValue( final String    key,
                                final float     defaultValue )
    {
        return formatFloatValue( key, getFormattedPropValue( key ), defaultValue );
    }
1213243
public static Float extractToFloat(final DeviceAttribute deviceAttributeRead) throws DevFailed {
	final Object value = AttributeHelper.extract(deviceAttributeRead);
	Float argout = null;
	if (value instanceof Short) {
	    argout = Float.valueOf(((Short) value).floatValue());
	} else if (value instanceof String) {
	    try {
		argout = Float.valueOf((String) value);
	    } catch (final Exception e) {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value
			+ " is not a numerical",
			"AttributeHelper.extractToFloat(deviceAttributeWritten)");
	    }
	} else if (value instanceof Integer) {
	    argout = Float.valueOf(((Integer) value).floatValue());
	} else if (value instanceof Long) {
	    argout = Float.valueOf(((Long) value).floatValue());
	} else if (value instanceof Float) {
	    argout = Float.valueOf(((Float) value).floatValue());
	} else if (value instanceof Boolean) {
	    if (((Boolean) value).booleanValue()) {
		argout = Float.valueOf(1);
	    } else {
		argout = Float.valueOf(0);
	    }
	} else if (value instanceof Double) {
	    argout = Float.valueOf(((Double) value).floatValue());
	} else if (value instanceof DevState) {
	    argout = Float.valueOf(Integer.valueOf(((DevState) value).value()).floatValue());
	} else {
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value.getClass()
		    + " not supported",
		    "AttributeHelper.extractToFloat(Object value,deviceAttributeWritten)");
	}

	return argout;
    }
1368051
public int readInteger(int defaultValue, String attribute)
    {
        return Integer.parseInt(getValue(String.valueOf(defaultValue), attribute));
    }