Example usage for java.lang Boolean valueOf

List of usage examples for java.lang Boolean valueOf

Introduction

In this page you can find the example usage for java.lang Boolean valueOf.

Prototype

public static Boolean valueOf(String s) 

Source Link

Document

Returns a Boolean with a value represented by the specified string.

Usage

From source file:com.wabacus.system.datatype.BooleanType.java

public Object label2value(String label) {
    if (label == null || label.trim().equals(""))
        return Boolean.FALSE;
    return Boolean.valueOf(label.trim());
}

From source file:com.francetelecom.clara.cloud.commons.toggles.PaasJndiStateRepository.java

@Override
public FeatureState getFeatureState(Feature feature) {
    try {//from w ww  .  j a  va 2s .  c om
        InitialContext jndiContext = getInitialContext();
        String value = (String) jndiContext.lookup(feature.name());
        if (!(value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false"))) {
            return null;
        }
        boolean enabled = Boolean.valueOf(value);
        List<String> users = getFeatureUsers(feature);
        FeatureState featureState = new FeatureState(feature, enabled, users);
        return featureState;
    } catch (NameNotFoundException e) {
        logger.warn("state of feature " + feature.name() + " is not already defined in jndi");
    } catch (NamingException e) {
        if (ExceptionUtils.indexOfType(e, NameNotFoundException.class) != -1) {
            logger.warn("state of feature " + feature.name() + " is not already defined in jndi");
        } else {
            logger.error("unable to read state of feature " + feature.name(), e);
        }
    } catch (ClassCastException e) {
        logger.error("unable to read state of feature " + feature.name(), e);
    }
    // By default return null (no feature state found or invalid)
    return null;
}

From source file:edu.vt.middleware.servlet.filter.ClientCertFilter.java

/**
 * Initialize this filter.//w ww  .  j  av  a2 s .c om
 *
 * @param  config  <code>FilterConfig</code>
 */
public void init(final FilterConfig config) {
    this.requireCert = Boolean.valueOf(config.getInitParameter(REQUIRE_CERT)).booleanValue();
    if (LOG.isDebugEnabled()) {
        LOG.debug("requireCert = " + this.requireCert);
    }

    final String issuerDn = config.getInitParameter(ISSUER_DN);
    if (issuerDn != null) {
        this.issuerDnPattern = Pattern.compile(issuerDn);
    }

    final String subjectDn = config.getInitParameter(SUBJECT_DN);
    if (subjectDn != null) {
        this.subjectDnPattern = Pattern.compile(subjectDn);
    }
}

From source file:io.personium.engine.rs.TestResource.java

/**
 * .//from w ww  .j  a v a 2  s.c  om
 * @param useDebug JavaScript ????????
 * @throws PersoniumEngineException PersoniumEngine
 */
public TestResource(@QueryParam("useScriptDebug") final String useDebug) throws PersoniumEngineException {
    // http://xxx/yy?useScriptDebug=true ?????useScriptDebug????useDebug?
    super();
    this.serviceSubject = "engine"; // "engine"??
    this.useScriptDebug = Boolean.valueOf(useDebug);
    log.info("Create DebugResource. useScriptDebug=" + this.useScriptDebug);
}

From source file:org.apache.ftpserver.config.spring.FileSystemBeanDefinitionParser.java

/**
 * {@inheritDoc}//from   www.  j a  v  a 2s .  c  o m
 */
@Override
protected void doParse(final Element element, final ParserContext parserContext,
        final BeanDefinitionBuilder builder) {
    if (StringUtils.hasText(element.getAttribute("case-insensitive"))) {
        builder.addPropertyValue("caseInsensitive", Boolean.valueOf(element.getAttribute("case-insensitive")));
    }
    if (StringUtils.hasText(element.getAttribute("create-home"))) {
        builder.addPropertyValue("createHome", Boolean.valueOf(element.getAttribute("create-home")));
    }
}

From source file:se.omegapoint.facepalm.client.config.Bootstrapper.java

@Override
@Transactional//  w ww . j  av  a2  s.  c  o  m
public void afterPropertiesSet() throws Exception {
    if (Boolean.valueOf(env.getProperty("bootstrap.data"))) {
        LOGGER.debug("Started bootstrapping of image posts");
        uploadImageFileWithTitle("He is right behind me, isn't he?", "samples/a.jpg");
        uploadImageFileWithTitle("I cant believe it doesn't work this way", "samples/b.jpg");
        uploadImageFileWithTitle("Mhmm.. pie", "samples/c.jpg");
        LOGGER.debug("Done with bootstrapping");
    }

    createDocumentsIfNotPresent();
}

From source file:hudson.plugins.ec2.util.DeviceMappingParser.java

private static EbsBlockDevice parseEbs(String blockDevice) {

    String[] parts = blockDevice.split(":");

    EbsBlockDevice ebs = new EbsBlockDevice();
    if (StringUtils.isNotBlank(getOrEmpty(parts, 0))) {
        ebs.setSnapshotId(parts[0]);/*from  w  w w  .j a  v  a 2 s  . c  o  m*/
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 1))) {
        ebs.setVolumeSize(Integer.valueOf(parts[1]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 2))) {
        ebs.setDeleteOnTermination(Boolean.valueOf(parts[2]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 3))) {
        ebs.setVolumeType(parts[3]);
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 4))) {
        ebs.setIops(Integer.valueOf(parts[4]));
    }
    if (StringUtils.isNotBlank(getOrEmpty(parts, 5))) {
        ebs.setEncrypted(parts[5].equals("encrypted"));
    }

    return ebs;
}

From source file:com.intuit.tank.vm.settings.ReportingInstance.java

/**
 * @return whether to reuse stopped instances or to start new ones. dependant
 *///from   w ww. j  ava  2s  .c o m
public boolean isRegionDependent() {
    boolean ret = false;
    String regionDependent = get("region-dependent");
    if (regionDependent != null) {
        ret = Boolean.valueOf(regionDependent);
    }
    return ret;
}

From source file:hr.diskobolos.converter.EvaluationConverter.java

@Override
public EvaluationDto convert(EvaluationQuestionDef evaluationQuestionDef) {
    EvaluationDto evaluationDto = new EvaluationDto();
    evaluationDto.setId(evaluationQuestionDef.getId());
    evaluationDto.setQuestion(evaluationQuestionDef.getQuestion().getName());
    evaluationDto.setGroup(evaluationQuestionDef.getQuestion().getGroup().name());
    evaluationDto.setQuestionnaireType(evaluationQuestionDef.getQuestionnaireType().name());
    evaluationDto.setLabel(messageSource.getMessage(evaluationQuestionDef.getQuestion().getLocalizationKey(),
            null, Locale.ENGLISH));
    List<EvaluationDto.Item> items = new ArrayList<>();
    for (QuestionChoicesDef choice : evaluationQuestionDef.getChoices()) {
        EvaluationDto.Item item = new EvaluationDto.Item();
        item.setId(choice.getId());//from  w w  w  .jav a 2  s  .co m
        item.setLabel(messageSource.getMessage(
                evaluationQuestionDef.getQuestion().getLocalizationKey().concat(".").concat(choice.getLabel()),
                null, Locale.ENGLISH));
        switch (choice.getValueType()) {
        case Boolean:
            item.setValue(Boolean.valueOf(choice.getValue()));
            break;
        case Integer:
            item.setValue(Integer.valueOf(choice.getValue()));
            break;
        default:
            item.setValue(choice.getValue());
            break;
        }
        items.add(item);
    }
    evaluationDto.setItems(items);
    return evaluationDto;
}

From source file:org.ff4j.services.AbstractStepDef.java

protected void createFeatures(List<FeaturePojo> features) {
    for (FeaturePojo featurePojo : features) {
        Feature feature = new Feature(featurePojo.getUid(), Boolean.valueOf(featurePojo.getEnable()),
                featurePojo.getDescription(), featurePojo.getGroup(),
                Arrays.asList(featurePojo.getPermissions().split(",")));
        createFeature(feature);//from   w  w w .j ava  2s.co m
    }
}