本文整理汇总了Java中org.apache.commons.lang3.BooleanUtils.toBooleanDefaultIfNull方法的典型用法代码示例。如果您正苦于以下问题:Java BooleanUtils.toBooleanDefaultIfNull方法的具体用法?Java BooleanUtils.toBooleanDefaultIfNull怎么用?Java BooleanUtils.toBooleanDefaultIfNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.BooleanUtils
的用法示例。
在下文中一共展示了BooleanUtils.toBooleanDefaultIfNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GptBrokerDefinitionAdaptor
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
* Creates instance of the adaptor.
* @param def broker definition
*/
public GptBrokerDefinitionAdaptor(EntityDefinition def) throws InvalidDefinitionException {
super(def);
this.credAdaptor = new CredentialsDefinitionAdaptor(def);
if (StringUtils.trimToEmpty(def.getType()).isEmpty()) {
def.setType(GptConnector.TYPE);
} else if (!GptConnector.TYPE.equals(def.getType())) {
throw new InvalidDefinitionException("Broker definition doesn't match");
} else {
try {
String sHostUrl = get(P_HOST_URL);
if (sHostUrl!=null) {
sHostUrl = sHostUrl.replaceAll("/*$", "/");
}
hostUrl = new URL(sHostUrl);
} catch (MalformedURLException ex) {
throw new InvalidDefinitionException(String.format("Invalid %s: %s", P_HOST_URL,get(P_HOST_URL)), ex);
}
forceAdd = Boolean.parseBoolean(get(P_FORCE_ADD));
cleanup = Boolean.parseBoolean(get(P_CLEANUP));
index = get(P_INDEX);
emitXml = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_ACCEPT_XML)), true);
emitJson = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_ACCEPT_JSON)), false);
}
}
示例2: AgpInputBrokerDefinitionAdaptor
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
* Creates instance of the adaptor.
* @param def broker definition
* @throws IllegalArgumentException if invalid broker definition
*/
public AgpInputBrokerDefinitionAdaptor(EntityDefinition def) throws InvalidDefinitionException {
super(def);
this.credAdaptor =new CredentialsDefinitionAdaptor(def);
this.botsAdaptor = new BotsBrokerDefinitionAdaptor(def);
if (StringUtils.trimToEmpty(def.getType()).isEmpty()) {
def.setType(AgpInputConnector.TYPE);
} else if (!AgpInputConnector.TYPE.equals(def.getType())) {
throw new InvalidDefinitionException("Broker definition doesn't match");
} else {
try {
hostUrl = new URL(get(P_HOST_URL));
} catch (MalformedURLException ex) {
throw new InvalidDefinitionException(String.format("Invalid %s: %s", P_HOST_URL,get(P_HOST_URL)), ex);
}
folderId = get(P_FOLDER_ID);
emitXml = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_XML)), true);
emitJson = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_JSON)), false);
}
}
示例3: GptBrokerDefinitionAdaptor
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
* Creates instance of the adaptor.
* @param def broker definition
*/
public GptBrokerDefinitionAdaptor(EntityDefinition def) throws InvalidDefinitionException {
super(def);
this.credAdaptor = new CredentialsDefinitionAdaptor(def);
this.botsAdaptor = new BotsBrokerDefinitionAdaptor(def);
if (StringUtils.trimToEmpty(def.getType()).isEmpty()) {
def.setType(GptConnector.TYPE);
} else if (!GptConnector.TYPE.equals(def.getType())) {
throw new InvalidDefinitionException("Broker definition doesn't match");
} else {
try {
String sHostUrl = get(P_HOST_URL);
if (sHostUrl!=null) {
sHostUrl = sHostUrl.replaceAll("/*$", "/");
}
hostUrl = new URL(sHostUrl);
} catch (MalformedURLException ex) {
throw new InvalidDefinitionException(String.format("Invalid %s: %s", P_HOST_URL,get(P_HOST_URL)), ex);
}
index = get(P_INDEX);
emitXml = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_XML)), true);
emitJson = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_JSON)), false);
}
}
示例4: AgsBrokerDefinitionAdaptor
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
* Creates instance of the adaptor.
* @param def broker definition
* @throws InvalidDefinitionException if invalid broker definition
*/
public AgsBrokerDefinitionAdaptor(EntityDefinition def) throws InvalidDefinitionException {
super(def);
this.credAdaptor =new CredentialsDefinitionAdaptor(def);
this.botsAdaptor = new BotsBrokerDefinitionAdaptor(def);
if (StringUtils.trimToEmpty(def.getType()).isEmpty()) {
def.setType(AgsConnector.TYPE);
} else if (!AgsConnector.TYPE.equals(def.getType())) {
throw new InvalidDefinitionException("Broker definition doesn't match");
} else {
try {
hostUrl = new URL(get(P_HOST_URL));
} catch (MalformedURLException ex) {
throw new InvalidDefinitionException(String.format("Invalid %s: %s", P_HOST_URL,get(P_HOST_URL)), ex);
}
enableLayers = BooleanUtils.toBoolean(get(P_ENABLE_LAYERS));
emitXml = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_XML)), true);
emitJson = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_JSON)), false);
}
}
示例5: initialize
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
* Initializes adaptor from definition.
* @param def broker definition
* @throws InvalidDefinitionException if definition is invalid
*/
protected void initialize(EntityDefinition def) throws InvalidDefinitionException {
apiKey = get(P_API_KEY);
emitXml = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_XML)), true);
emitJson = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_JSON)), false);
try {
hostUrl = new URL(get(P_HOST_URL));
} catch (MalformedURLException ex) {
throw new InvalidDefinitionException(String.format("Invalid %s: %s", P_HOST_URL,get(P_HOST_URL)), ex);
}
}
示例6: setParameters
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
@Override
public void setParameters(Map<String, String> params) throws ParametersException {
setElementParams(params);
leaveBlankSpace = BooleanUtils.toBooleanDefaultIfNull(
BooleanUtils.toBooleanObject(params.get(LEAVE_BLANK_SPACE_PARAM)),
LEAVE_BLANK_SPACE_DEFAULT);
}
示例7: parseGeneralString
import org.apache.commons.lang3.BooleanUtils; //导入方法依赖的package包/类
/**
* 支持true/false,on/off, y/n, yes/no的转换, str为空或无法分析时返回defaultValue
*/
public static Boolean parseGeneralString(String str, Boolean defaultValue) {
return BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(str), defaultValue);
}