Example usage for java.lang Integer intValue

List of usage examples for java.lang Integer intValue

Introduction

In this page you can find the example usage for java.lang Integer intValue.

Prototype

@HotSpotIntrinsicCandidate
public int intValue() 

Source Link

Document

Returns the value of this Integer as an int .

Usage

From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.db.ws.SubjectWSGetAsyncTask.java

/**
 * Returns list of subjects ordered by task_order
 * @return// ww w . j av a  2  s. c o  m
 */
public List<SubjectDO> orderedSubjects(List<SubjectDO> subjects) {

    SubjectDO[] ordered = new SubjectDO[subjects.size()];

    int i = 0;
    for (SubjectDO subjectDO : subjects) {
        Integer oI = new Integer(subjectDO.getSubject_task_order());
        ordered[oI.intValue()] = subjectDO;
        i++;
    }

    return Arrays.asList(ordered);
}

From source file:io.fabric8.maven.plugin.AbstractDeployMojo.java

public static Ingress createIngressForService(String routeDomainPostfix, String namespace, Service service,
        Log log) {/*from  ww  w . j  a  v a  2 s  .  c  o  m*/
    Ingress ingress = null;
    String serviceName = KubernetesHelper.getName(service);
    ServiceSpec serviceSpec = service.getSpec();
    if (serviceSpec != null && Strings.isNotBlank(serviceName)
            && shouldCreateExternalURLForService(log, service, serviceName)) {
        String ingressId = serviceName;
        String host = "";
        if (Strings.isNotBlank(routeDomainPostfix)) {
            host = serviceName + "." + namespace + "." + Strings.stripPrefix(routeDomainPostfix, ".");
        }
        List<HTTPIngressPath> paths = new ArrayList<>();
        List<ServicePort> ports = serviceSpec.getPorts();
        if (ports != null) {
            for (ServicePort port : ports) {
                Integer portNumber = port.getPort();
                if (portNumber != null) {
                    HTTPIngressPath path = new HTTPIngressPathBuilder().withNewBackend()
                            .withServiceName(serviceName)
                            .withServicePort(createIntOrString(portNumber.intValue())).endBackend().build();
                    paths.add(path);
                }
            }
        }
        if (paths.isEmpty()) {
            return ingress;
        }
        ingress = new IngressBuilder().withNewMetadata().withName(ingressId).withNamespace(namespace)
                .endMetadata().withNewSpec().addNewRule().withHost(host).withNewHttp().withPaths(paths)
                .endHttp().endRule().endSpec().build();

        String json;
        try {
            json = KubernetesHelper.toJson(ingress);
        } catch (JsonProcessingException e) {
            json = e.getMessage() + ". object: " + ingress;
        }
        log.debug("Created ingress: " + json);
    }
    return ingress;
}

From source file:com.aurel.track.fieldType.fieldChange.converter.DateSetterConverter.java

/**
 * Gets the show value transformed form the stored configuration in database 
 * @param value/*from  w w  w .j  a v a2  s.co  m*/
 * @param fieldID
 * @param setter
 * @param locale
 * @return
 */
@Override
public String getDisplayValueFromStoredString(String value, Integer fieldID, Integer setter, Locale locale) {
    if (setter == null) {
        return "";
    }
    switch (setter.intValue()) {
    case FieldChangeSetters.MOVE_BY_DAYS:
        Integer intValue = (Integer) getActualValueFromStoredString(value, setter);
        if (intValue != null) {
            return intValue.toString();
        }
    case FieldChangeSetters.SET_TO_DATE_FIELD_VALUE:
        Integer dateFieldID = (Integer) getActualValueFromStoredString(value, setter);
        if (dateFieldID != null) {
            return FieldRuntimeBL.getLocalizedDefaultFieldLabel(dateFieldID, locale);
        }
    case FieldChangeSetters.SET_TO:
        Date dateValue = (Date) getActualValueFromStoredString(value, setter);
        if (dateValue != null) {
            return DateTimeUtils.getInstance().formatGUIDate(dateValue, locale);
        }
    }
    return "";
}

From source file:it.geosolutions.geobatch.destination.vulnerability.ResultStatsMap.java

private String fromPixelValueToTargetId(Integer pixelValue) {
    return COP_SUOLO_PREFIX + PROP_NAMESPACE_SEPARATOR + valuesZone.get(pixelValue.intValue());
}

From source file:com.aurel.track.fieldType.runtime.matchers.converter.DoubleMatcherConverter.java

/**
 * Convert a string to object value/*ww  w .  j  a v  a 2s.  c o  m*/
 * By changing the matcherID for a field expression locally
 * (not after submitting a form). The reason for this is to maintain the existing
 * value if the new matcher is "compatible" with the old matcher 
 * @param valueString
 * @param locale
 * @param matcherRelation
 * @return
 */
@Override
public Object fromValueString(String valueString, Locale locale, Integer matcherRelation) {
    if (matcherRelation != null) {
        switch (matcherRelation.intValue()) {
        case MatchRelations.EQUAL:
        case MatchRelations.NOT_EQUAL:
        case MatchRelations.GREATHER_THAN:
        case MatchRelations.GREATHER_THAN_EQUAL:
        case MatchRelations.LESS_THAN:
        case MatchRelations.LESS_THAN_EQUAL:
            return DoubleNumberFormatUtil.getInstance().parseGUI(valueString, locale);
        }
    }
    return null;
}

From source file:com.nagarro.core.security.impl.DefaultBruteForceAttackCounter.java

public DefaultBruteForceAttackCounter(final Integer maxFailedLogins, final Integer cacheExpiration,
        final Integer cacheSizeLimit) {
    bruteForceAttackCache = new ConcurrentHashMap((int) 0.5 * cacheSizeLimit.intValue());
    this.maxFailedLogins = maxFailedLogins;
    this.cacheSizeLimit = cacheSizeLimit;
    this.cacheExpiration = cacheExpiration;
}

From source file:net.sourceforge.fenixedu.domain.onlineTests.TestQuestion.java

private void organizeTestQuestionsOrder(Integer newOrder, Integer oldOrder) {
    Collection<TestQuestion> testQuestions = getTest().getTestQuestionsSet();
    int diffOrder = newOrder.intValue() - oldOrder.intValue();
    if (diffOrder != 0) {
        if (diffOrder > 0) {
            for (TestQuestion testQuestion : testQuestions) {
                if (testQuestion.getTestQuestionOrder().compareTo(newOrder) <= 0
                        && testQuestion.getTestQuestionOrder().compareTo(oldOrder) > 0) {
                    testQuestion.setTestQuestionOrder(testQuestion.getTestQuestionOrder() - 1);
                }/*from  ww w .j a v a  2  s .com*/
            }
        } else {
            for (TestQuestion testQuestion : testQuestions) {
                if (testQuestion.getTestQuestionOrder().compareTo(newOrder) >= 0
                        && testQuestion.getTestQuestionOrder().compareTo(oldOrder) < 0) {
                    testQuestion.setTestQuestionOrder(testQuestion.getTestQuestionOrder() + 1);
                }
            }
        }
    }
}

From source file:com.redhat.rhn.frontend.action.user.UserPrefAction.java

/**
 * Returns the Integer property from the given form as an int.  If property
 * does not exist we return the default value specified by def.
 * @param form DynaActionForm containing the property.
 * @param property Property to be transformed.
 * @param def Default value if property is null.
 * @return the Integer property from the given form as an int.  If property
 * does not exist we return the default value specified by def.
 *//*from  w ww. j av a 2  s .c  om*/
private int getAsInt(DynaActionForm form, String property, int def) {
    Integer i = (Integer) form.get(property);
    if (i == null) {
        return def;
    }
    return i.intValue();
}

From source file:org.eclipse.swt.examples.addressbook.DataEntryDialog.java

private void addTextListener(final Text text) {
    text.addModifyListener(e -> {/*from w w w  .java  2 s .co m*/
        Integer index = (Integer) (text.getData("index"));
        values[index.intValue()] = text.getText();
    });
}

From source file:com.org.services.impl.PersonServiceImpl.java

/**
 * /*  w  ww  .ja  va 2  s .co m*/
 * @see com.org.services.PersonService#findById(java.lang.Integer)
 */
@Override
public Person findById(Integer id) {
    logger.debug("find person dao");
    if (id == null || id.intValue() <= 0) {
        return null;
    }
    try {
        personDao = new PersonDaoImpl(persistenceUnit, dbName);
        return personDao.findById(id);
    } catch (DaoException e) {
        logger.error("Error ", e);
        return null;
    }
}