本文整理了Java中java.lang.Float.<init>()
方法的一些代码示例,展示了Float.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Float.<init>()
方法的具体详情如下:
包路径:java.lang.Float
类名称:Float
方法名:<init>
[英]Constructs a new Float with the specified primitive double value.
[中]使用指定的基元双精度值构造新浮点。
代码示例来源:origin: apache/incubator-dubbo
@Override
public Object decode(Object jv) {
if (jv instanceof Number) {
return new Float(((Number) jv).floatValue());
}
return (Float) null;
}
};
代码示例来源:origin: apache/incubator-dubbo
@Override
public Object decode(Object jv) {
if (jv instanceof Number) {
return new Float(((Number) jv).floatValue());
}
return (Float) null;
}
};
代码示例来源:origin: libgdx/libgdx
private Object toObject (String key, String value) {
if (key.endsWith("b")) return new Boolean(Boolean.parseBoolean(value));
if (key.endsWith("i")) return new Integer(Integer.parseInt(value));
if (key.endsWith("l")) return new Long(Long.parseLong(value));
if (key.endsWith("f")) return new Float(Float.parseFloat(value));
return value;
}
代码示例来源:origin: spring-projects/spring-framework
private Float getFloat() {
return new Float("12.99");
}
代码示例来源:origin: google/guava
@Generates
private Float generateFloatObject() {
return new Float(generateFloat());
}
代码示例来源:origin: spring-projects/spring-framework
public Object addOne(ProceedingJoinPoint pjp, Float value) throws Throwable {
float fv = value.floatValue();
return pjp.proceed(new Object[] {new Float(fv + 1.0F)});
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new Float(text));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
@Deprecated
public void hashCodeWithFloat() {
float flt = 34.8f;
int expected = (new Float(flt)).hashCode();
assertEquals(expected, ObjectUtils.hashCode(flt));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testMathOperatorDivide04_ConvertToFloat() {
evaluateAndAskForReturnType("8/4", new Float(2.0), Float.class);
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void skipImmutableFloat() {
doSkipImmutableValue(new Float(1.1));
}
代码示例来源:origin: greenrobot/EventBus
@Test
public void testGenericEventAndSubscriber_BaseType() {
GenericNumberEventSubscriber<Float> genericSubscriber = new GenericNumberEventSubscriber<>();
eventBus.register(genericSubscriber);
eventBus.post(new Float(42));
eventBus.post(new Double(23));
assertEventCount(2);
eventBus.post("Not the same base type");
assertEventCount(2);
}
代码示例来源:origin: greenrobot/EventBus
@Test
public void testGenericEventAndSubscriber_Subclass() {
GenericFloatEventSubscriber genericSubscriber = new GenericFloatEventSubscriber();
eventBus.register(genericSubscriber);
eventBus.post(new Float(42));
eventBus.post(new Double(77));
assertEventCount(2);
eventBus.post("Not the same base type");
assertEventCount(2);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected TestBean createTestBean() {
this.bean = new TestBean();
bean.setName("Sally Greenwood");
bean.setMyFloat(new Float("12.34"));
return bean;
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void SPR12808() {
SpelExpressionParser parser = new SpelExpressionParser();
Expression expression = parser.parseExpression("T(org.springframework.expression.spel.SpelReproTests.DistanceEnforcer).from(#no)");
StandardEvaluationContext sec = new StandardEvaluationContext();
sec.setVariable("no", new Integer(1));
assertTrue(expression.getValue(sec).toString().startsWith("Integer"));
sec = new StandardEvaluationContext();
sec.setVariable("no", new Float(1.0));
assertTrue(expression.getValue(sec).toString().startsWith("Number"));
sec = new StandardEvaluationContext();
sec.setVariable("no", "1.0");
assertTrue(expression.getValue(sec).toString().startsWith("Object"));
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected TestBean createTestBean() {
this.bean = new TestBeanWithRealCountry();
this.bean.setName("Rob");
this.bean.setCountry("UK");
this.bean.setSex("M");
this.bean.setMyFloat(new Float("12.34"));
this.bean.setSomeIntegerArray(new Integer[]{new Integer(12), new Integer(34)});
return this.bean;
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected void extendRequest(MockHttpServletRequest request) {
TestBean bean = new TestBean();
bean.setName("foo");
bean.setFavouriteColour(Colour.GREEN);
bean.setStringArray(ARRAY);
bean.setSpouse(new TestBean("Sally"));
bean.setSomeNumber(new Float("12.34"));
List friends = new ArrayList();
friends.add(new TestBean("bar"));
friends.add(new TestBean("penc"));
bean.setFriends(friends);
request.setAttribute("testBean", bean);
}
代码示例来源:origin: greenrobot/EventBus
@Test
public void testGenericEventAndSubscriber_Subclass() {
GenericFloatEventSubscriber genericSubscriber = new GenericFloatEventSubscriber();
eventBus.register(genericSubscriber);
eventBus.post(new Float(42));
eventBus.post(new Double(77));
assertEventCount(2);
eventBus.post("Not the same base type");
assertEventCount(2);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected TestBean createTestBean() {
// set up test data
this.rob = new TestBean();
this.rob.setName("Rob");
this.rob.setMyFloat(new Float(12.34));
TestBean sally = new TestBean();
sally.setName("Sally");
this.rob.setSpouse(sally);
return this.rob;
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected TestBean createTestBean() {
// set up test data
this.rob = new TestBean();
rob.setName("Rob");
rob.setMyFloat(new Float(12.34));
TestBean sally = new TestBean();
sally.setName("Sally");
rob.setSpouse(sally);
return rob;
}
代码示例来源:origin: greenrobot/EventBus
@Test
public void testGenericEventAndSubscriber_BaseType() {
GenericNumberEventSubscriber<Float> genericSubscriber = new GenericNumberEventSubscriber<>();
eventBus.register(genericSubscriber);
eventBus.post(new Float(42));
eventBus.post(new Double(23));
assertEventCount(2);
eventBus.post("Not the same base type");
assertEventCount(2);
}
内容来源于网络,如有侵权,请联系作者删除!