/** * Read property as <code>Float</code>. * * @param propertyName name of property. * @return property as <code>Float</code>. */ public static Float pFloat(String propertyName){ return Convert.toFloat(p(propertyName)); }
/** * Gets attribute value as <code>Float</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Float</code>, given the attribute value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toFloat(Object)}. * * @param attributeName name of attribute to convert * @return value converted to <code>Float</code> */ public Float getFloat(String attributeName) { Object value = getRaw(attributeName); Converter<Object, Float> converter = modelRegistryLocal.converterForValue(attributeName, value, Float.class); return converter != null ? converter.convert(value) : Convert.toFloat(value); }
/** * Sets attribute value as <code>Float</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Float</code>, given the value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toFloat(Object)}. * * @param attributeName name of attribute. * @param value value to convert. * @return reference to this model. */ public <T extends Model> T setFloat(String attributeName, Object value) { Converter<Object, Float> converter = modelRegistryLocal.converterForValue(attributeName, value, Float.class); return setRaw(attributeName, converter != null ? converter.convert(value) : Convert.toFloat(value)); }
/** * float value assigned by controller. * * @param name name of a value assigned by controller. * @return a single value assigned by controller. */ protected float valFloat(String name) { assert name != null; return Convert.toFloat(val(name)); }
/** * Convenience method, returns object from session, equivalent of: * <pre> * <code> * Float val = (Float)session().get(name) * </code> * </pre> * * @param name name of object * @return value */ protected Float sessionFloat(String name){ return Convert.toFloat(session(name)); }
/** * Convenience method, returns object from session, equivalent of: * <pre> * <code> * Float val = (Float)session().get(name) * </code> * </pre> * * @param name name of object * @return value */ protected Float sessionFloat(String name){ return Convert.toFloat(session().get(name)); }
/** * Sets attribute value as <code>Float</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Float</code>, given the value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toFloat(Object)}. * * @param attributeName name of attribute. * @param value value to convert. * @return reference to this model. */ public <T extends Model> T setFloat(String attributeName, Object value) { Converter<Object, Float> converter = modelRegistryLocal().converterForValue(attributeName, value, Float.class); return setRaw(attributeName, converter != null ? converter.convert(value) : Convert.toFloat(value)); }
/** * Gets attribute value as <code>Float</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Float</code>, given the attribute value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toFloat(Object)}. * * @param attributeName name of attribute to convert * @return value converted to <code>Float</code> */ public Float getFloat(String attributeName) { Object value = getRaw(attributeName); Converter<Object, Float> converter = modelRegistryLocal().converterForValue(attributeName, value, Float.class); return converter != null ? converter.convert(value) : Convert.toFloat(value); }
/** * Sets attribute value as <code>Float</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Float</code>, given the value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toFloat(Object)}. * * @param attributeName name of attribute. * @param value value to convert. * @return reference to this model. */ public <T extends Model> T setFloat(String attributeName, Object value) { Converter<Object, Float> converter = modelRegistryLocal().converterForValue(attributeName, value, Float.class); return setRaw(attributeName, converter != null ? converter.convert(value) : Convert.toFloat(value)); }
/** * Gets attribute value as <code>Float</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Float</code>, given the attribute value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toFloat(Object)}. * * @param attributeName name of attribute to convert * @return value converted to <code>Float</code> */ public Float getFloat(String attributeName) { Object value = getRaw(attributeName); Converter<Object, Float> converter = modelRegistryLocal().converterForValue(attributeName, value, Float.class); return converter != null ? converter.convert(value) : Convert.toFloat(value); }