List of usage examples for org.apache.commons.lang3 BooleanUtils toIntegerObject
public static Integer toIntegerObject(final Boolean bool)
Converts a Boolean to a Integer using the convention that zero is false .
null will be converted to null .
BooleanUtils.toIntegerObject(Boolean.TRUE) = Integer.valueOf(1) BooleanUtils.toIntegerObject(Boolean.FALSE) = Integer.valueOf(0)
From source file:com.mirth.connect.model.UpdateSettings.java
public Properties getProperties() { Properties properties = new Properties(); if (getStatsEnabled() != null) { properties.put(STATS_ENABLED, BooleanUtils.toIntegerObject(getStatsEnabled()).toString()); }/*from w ww. j av a2s . c o m*/ if (getLastStatsTime() != null) { properties.put(LAST_STATS_TIME, getLastStatsTime().toString()); } return properties; }
From source file:com.mirth.connect.model.ServerSettings.java
@Override public Properties getProperties() { Properties properties = new Properties(); if (getClearGlobalMap() != null) { properties.put(CLEAR_GLOBAL_MAP, BooleanUtils.toIntegerObject(getClearGlobalMap()).toString()); }/*from ww w. j av a 2 s . c o m*/ if (getQueueBufferSize() != null) { properties.put(QUEUE_BUFFER_SIZE, getQueueBufferSize().toString()); } if (getDefaultMetaDataColumns() != null) { properties.put(DEFAULT_METADATA_COLUMNS, ObjectXMLSerializer.getInstance().serialize(getDefaultMetaDataColumns())); } if (getSmtpHost() != null) { properties.put(SMTP_HOST, getSmtpHost()); } if (getSmtpPort() != null) { properties.put(SMTP_PORT, getSmtpPort()); } if (getSmtpTimeout() != null) { properties.put(SMTP_TIMEOUT, getSmtpTimeout().toString()); } if (getSmtpFrom() != null) { properties.put(SMTP_FROM, getSmtpFrom()); } if (getSmtpSecure() != null) { properties.put(SMTP_SECURE, getSmtpSecure()); } if (getSmtpAuth() != null) { properties.put(SMTP_AUTH, BooleanUtils.toIntegerObject(getSmtpAuth()).toString()); } if (getSmtpUsername() != null) { properties.put(SMTP_USERNAME, getSmtpUsername()); } if (getSmtpPassword() != null) { properties.put(SMTP_PASSWORD, getSmtpPassword()); } return properties; }
From source file:yoyo.framework.standard.shared.commons.lang.BooleanUtilsTest.java
@Test public void test() { assertThat(BooleanUtils.and(new boolean[] { true }), is(true)); assertThat(BooleanUtils.and(new boolean[] { true, false }), is(false)); assertThat(BooleanUtils.isFalse(false), is(true)); assertThat(BooleanUtils.isNotFalse(false), is(false)); assertThat(BooleanUtils.isNotTrue(true), is(false)); assertThat(BooleanUtils.isTrue(true), is(true)); assertThat(BooleanUtils.negate(Boolean.FALSE), is(true)); assertThat(BooleanUtils.or(new boolean[] { true }), is(true)); assertThat(BooleanUtils.or(new boolean[] { true, false }), is(true)); assertThat(BooleanUtils.toBoolean(Boolean.TRUE), is(true)); assertThat(BooleanUtils.toBoolean(0), is(false)); assertThat(BooleanUtils.toBoolean(1), is(true)); assertThat(BooleanUtils.toBoolean((String) null), is(false)); assertThat(BooleanUtils.toBoolean("true"), is(true)); assertThat(BooleanUtils.toBoolean("hoge"), is(false)); assertThat(BooleanUtils.toBooleanDefaultIfNull(null, false), is(false)); assertThat(BooleanUtils.toBooleanObject(0), is(Boolean.FALSE)); assertThat(BooleanUtils.toBooleanObject(1), is(Boolean.TRUE)); assertThat(BooleanUtils.toInteger(true), is(1)); assertThat(BooleanUtils.toInteger(false), is(0)); assertThat(BooleanUtils.toIntegerObject(true), is(Integer.valueOf(1))); assertThat(BooleanUtils.toIntegerObject(false), is(Integer.valueOf(0))); assertThat(BooleanUtils.toString(true, "true", "false"), is("true")); assertThat(BooleanUtils.toString(false, "true", "false"), is("false")); assertThat(BooleanUtils.toStringOnOff(true), is("on")); assertThat(BooleanUtils.toStringOnOff(false), is("off")); assertThat(BooleanUtils.toStringTrueFalse(true), is("true")); assertThat(BooleanUtils.toStringTrueFalse(false), is("false")); assertThat(BooleanUtils.toStringYesNo(true), is("yes")); assertThat(BooleanUtils.toStringYesNo(false), is("no")); assertThat(BooleanUtils.xor(new boolean[] { true }), is(true)); assertThat(BooleanUtils.xor(new boolean[] { true, false }), is(true)); assertThat(BooleanUtils.xor(new boolean[] { true, true }), is(false)); }