Example usage for java.lang Boolean booleanValue

List of usage examples for java.lang Boolean booleanValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public boolean booleanValue() 

Source Link

Document

Returns the value of this Boolean object as a boolean primitive.

Usage

From source file:com.hippoapp.asyncmvp.http.RetryHandler.java

@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    boolean retry;

    Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());

    if (executionCount > DEFAULT_MAX_RETRIES) {
        retry = false;//from w  w w . jav a2s.  c o m
    } else if (sUnretriedExceptionSet.contains(exception.getClass())) {
        retry = false;
    } else if (sRetriedExceptionSet.contains(exception.getClass())) {
        retry = true;
    } else if (!sent) {
        // for most other errors, retry only if request hasn't been fully
        // sent yet
        retry = true;
    } else {
        // resend all idempotent requests
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
        String requestType = currentReq.getMethod();
        if (!requestType.equals("POST")) {
            retry = true;
        } else {
            // otherwise do not retry
            retry = false;
        }
    }

    if (retry) {
        SystemClock.sleep(RETRY_SLEEP_TIME_IN_MILLS);
    } else {
        exception.printStackTrace();
    }

    return retry;
}

From source file:cn.com.dfc.pl.afinal.http.RetryHandler.java

@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    boolean retry = true;

    Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());

    if (executionCount > maxRetries) {
        // ?5//from   w  ww  . j  a  v a 2  s.c  o  m
        retry = false;
    } else if (exceptionBlacklist.contains(exception.getClass())) {
        // ??
        retry = false;
    } else if (exceptionWhitelist.contains(exception.getClass())) {
        retry = true;
    } else if (!sent) {
        retry = true;
    }

    if (retry) {
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
        retry = currentReq != null && !"POST".equals(currentReq.getMethod());
    }

    if (retry) {
        //1???
        SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS);
    } else {
        exception.printStackTrace();
    }

    return retry;
}

From source file:com.my.cloudcontact.http.RetryHandler.java

@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    boolean retry = true;

    Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());

    if (executionCount > maxRetries) {
        // ?5//from   w ww  . j a  v  a 2 s .  co m
        retry = false;
    } else if (exceptionBlacklist.contains(exception.getClass())) {
        // ??
        retry = false;
    } else if (exceptionWhitelist.contains(exception.getClass())) {
        retry = true;
    } else if (!sent) {
        retry = true;
    }

    if (retry) {
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
        retry = currentReq != null && !"POST".equals(currentReq.getMethod());
    }

    if (retry) {
        // 1???
        SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS);
    } else {
        exception.printStackTrace();
    }

    return retry;
}

From source file:at.porscheinformatik.common.spring.web.extended.config.SpringWebExtendedRegistrar.java

private void handleAssetController(Map<String, Object> annotationAttributes, BeanDefinitionRegistry registry) {
    Boolean register = (Boolean) annotationAttributes.get(ASSETCONTROLLER_KEY);

    if (register != null && register.booleanValue()) {
        registerAssetController(registry);
    }/*www . ja  v a2 s. c o m*/
}

From source file:at.porscheinformatik.common.spring.web.extended.config.SpringWebExtendedRegistrar.java

private void handleStyleController(Map<String, Object> annotationAttributes, BeanDefinitionRegistry registry) {
    Boolean register = (Boolean) annotationAttributes.get(STYLECONTROLLER_KEY);

    if (register != null && register.booleanValue()) {
        registerStyleController(registry);
    }/* ww w  .  ja  v a2s  . c  om*/
}

From source file:at.porscheinformatik.common.spring.web.extended.config.SpringWebExtendedRegistrar.java

private void handleScriptController(Map<String, Object> annotationAttributes, BeanDefinitionRegistry registry) {
    Boolean register = (Boolean) annotationAttributes.get(SCRIPTCONTROLLER_KEY);

    if (register != null && register.booleanValue()) {
        registerScriptController(registry);
    }/*from  ww w.j  a  va  2s .  c  o  m*/
}

From source file:module.mobility.domain.MobilitySystem.java

public Collection<String> getServiceNotificationEmails() {
    Collection<String> emails = new HashSet<String>();
    for (PersonalPortfolio personalPortfolio : getPersonalPortfolioSet()) {
        final Boolean notificationService = personalPortfolio.getNotificationService();
        if (notificationService != null && notificationService.booleanValue()) {
            String email = personalPortfolio.getPerson().getUser().getEmail();
            if (!StringUtils.isEmpty(email)) {
                emails.add(email);/*from  www  .  java  2s .c  o m*/
            }
        }
    }
    return emails;
}

From source file:com.aurel.track.fieldType.runtime.matchers.run.BooleanMatcherRT.java

/**
 * Whether the value matches or not/* w  w  w  .  j a v a2s  .  c o  m*/
 * @param attributeValue
 * @return
 */
@Override
public boolean match(Object attributeValue) {
    Boolean nullMatch = nullMatcher(attributeValue);
    if (nullMatch != null) {
        return nullMatch.booleanValue();
    }
    if (attributeValue == null) {
        return false;
    }
    Boolean attributeValueBoolean = null;
    try {
        attributeValueBoolean = (Boolean) attributeValue;
    } catch (Exception e) {
        LOGGER.error("Converting the attribute value " + attributeValue + " of type "
                + attributeValue.getClass().getName() + " to Boolean failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
        return false;
    }
    switch (relation) {
    case MatchRelations.SET:
        return attributeValueBoolean.booleanValue();
    case MatchRelations.RESET:
        return !attributeValueBoolean.booleanValue();
    default:
        return false;
    }
}

From source file:at.uni_salzburg.cs.ckgroup.pilot.PositionProxy.java

public void fetchCurrentPosition() {
    HttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet(pilotPositionUrl);
    HttpResponse response;/*w  w  w. j  a v a 2 s.  c  om*/

    String responseString = "";
    try {
        response = httpclient.execute(httpget);
        int statusCode = response.getStatusLine().getStatusCode();
        if (statusCode == 200) {
            responseString = EntityUtils.toString(response.getEntity());
        } else {
            LOG.error("Error at accessing " + pilotPositionUrl + " code=" + statusCode + " reason="
                    + response.getStatusLine().getReasonPhrase());
        }
    } catch (Exception e) {
        LOG.error("Can not access " + pilotPositionUrl, e);
    }

    JSONParser parser = new JSONParser();
    try {
        JSONObject obj = (JSONObject) parser.parse(responseString);

        latitude = (Double) obj.get("latitude");
        longitude = (Double) obj.get("longitude");
        altitude = (Double) obj.get("altitude");
        //         courseOverGround = (Double)obj.get("courseOverGround");
        //         speedOverGround = (Double)obj.get("speedOverGround");
        //         altitudeOverGround = (Double)obj.get("altitudeOverGround");
        Boolean apf = (Boolean) obj.get("autoPilotFlight");
        autoPilotFlight = apf != null ? apf.booleanValue() : false;
    } catch (ParseException e) {
        LOG.error("Error at fetching current position from " + pilotPositionUrl);
    }
}

From source file:UndoableToggleApp4.java

public void restoreState(Hashtable ht) {
    Boolean b1 = (Boolean) ht.get(tog);
    if (b1 != null)
        tog.setSelected(b1.booleanValue());
    Boolean b2 = (Boolean) ht.get(cb);
    if (b2 != null)
        cb.setSelected(b2.booleanValue());
    Boolean b3 = (Boolean) ht.get(radio);
    if (b3 != null)
        radio.setSelected(b3.booleanValue());
}