Justin Buist was browsing through some code in his company's ERP system and saw something that piqued his interest ...

//audit transactions cannot be verified
if (isAuditType(transCode))
{
	evtProvider.VerifyTransaction = Truth.EVT_VERIFY_TRANSACTION_TRUE;
}

It seemed a bit odd, especially considering that VerifyTransaction is a Boolean. He shrugged it off and continued to look through the code. But a bit further down there was a similar statement ...

transOrg.HasContent = Truth.ORG_HAS_CONTENT_FALSE;

... and then another, and then another, and then another. He finally decided to get to the bottom of these Boolean constants and discovered the bulk of today's example, Truth.java:

public static final Boolean BASE_TRUE = Boolean.TRUE;
public static final Boolean BASE_FALSE = Boolean.FALSE;
/* ... */
public static final Boolean EVT_VERIFY_TRANSACTION_TRUE = BASE_TRUE;
public static final Boolean EVT_VERIFY_TRANSACTION_FALSE = BASE_FALSE;
public static final Boolean EVT_ACTION_REQUIRED_TRUE = BASE_TRUE;
public static final Boolean EVT_ACTION_REQUIRED_FALSE = BASE_FALSE;
public static final Boolean EVT_TRANS_SETUP_TRUE = BASE_TRUE;
public static final Boolean EVT_TRANS_SETUP_FALSE = BASE_FALSE;
/* ... */
public static final Boolean ORG_HAS_CONTENT_TRUE = BASE_TRUE;
public static final Boolean ORG_HAS_CONTENT_FALSE = BASE_FALSE;
public static final Boolean ORG_IS_NEW_TRUE = BASE_TRUE;
public static final Boolean ORG_IS_NEW_FALSE = BASE_FALSE;
public static final Boolean ORG_ENABLED_TRUE = BASE_TRUE;
public static final Boolean ORG_ENABLED_FALSE = BASE_FALSE;

An intresting approach, I must say. It comes in handy when you want "Enabled = False" to really mean that it's enabled.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!