Example usage for java.lang Number intValue

List of usage examples for java.lang Number intValue

Introduction

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

Prototype

public abstract int intValue();

Source Link

Document

Returns the value of the specified number as an int .

Usage

From source file:com.prowidesoftware.swift.model.field.Field133.java

/**
 * Set the component4 from a Number object.
 * <br />//from  www. j a  v a  2 s.  c o  m
 * <em>If the component being set is a fixed length number, the argument will not be 
 * padded.</em> It is recommended for these cases to use the setComponent4(String) 
 * method.
 * 
 * @see #setComponent4(String)
 *
 * @param component4 the Number with the component4 content to set
 */
public Field133 setComponent4(java.lang.Number component4) {
    if (component4 != null) {
        setComponent(4, "" + component4.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field137.java

/**
 * Set the component4 from a Number object.
 * <br />//from  w  w  w.j a v  a  2s .c o  m
 * <em>If the component being set is a fixed length number, the argument will not be 
 * padded.</em> It is recommended for these cases to use the setComponent4(String) 
 * method.
 * 
 * @see #setComponent4(String)
 *
 * @param component4 the Number with the component4 content to set
 */
public Field137 setComponent4(java.lang.Number component4) {
    if (component4 != null) {
        setComponent(4, "" + component4.intValue());
    }
    return this;
}

From source file:com.rogchen.common.xml.UtilDateTime.java

/**
 * ?  //ww w  .  j  av a  2s . co  m
 *
 * @param stamp
 * @param daysLater
 * @param monthsLater
 * @param yearsLater
 * @return
 */
public static Timestamp getYearStart(Timestamp stamp, Number daysLater, Number monthsLater, Number yearsLater) {
    return getYearStart(stamp, (daysLater == null ? 0 : daysLater.intValue()),
            (monthsLater == null ? 0 : monthsLater.intValue()),
            (yearsLater == null ? 0 : yearsLater.intValue()));
}

From source file:nz.co.senanque.rules.OperationsImpl.java

@InternalFunction()
public Date addDays(Date date, Number days) {
    if (date == null || days == null) {
        return null;
    }//from  w  w w.j  a va 2s  .  c  om
    Calendar calendar = getCalendar(date);
    calendar.add(Calendar.DAY_OF_YEAR, days.intValue());
    Date ret = calendar.getTime();
    return ret;
}

From source file:nz.co.senanque.rules.OperationsImpl.java

@InternalFunction()
public Date subtractDays(Date date, Number days) {
    if (date == null || days == null) {
        return null;
    }/*from   w  ww . jav a  2  s .  co  m*/
    Calendar calendar = getCalendar(date);
    calendar.add(Calendar.DAY_OF_YEAR, days.intValue() * -1);
    Date ret = calendar.getTime();
    return ret;
}

From source file:com.prowidesoftware.swift.model.field.Field130.java

/**
 * Set the component1 from a Number object.
 * <br />// ww  w . ja  va2s .  c  o  m
 * <em>If the component being set is a fixed length number, the argument will not be 
 * padded.</em> It is recommended for these cases to use the setComponent1(String) 
 * method.
 * 
 * @see #setComponent1(String)
 *
 * @param component1 the Number with the component1 content to set
 */
public Field130 setComponent1(java.lang.Number component1) {
    if (component1 != null) {
        setComponent(1, "" + component1.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field130.java

/**
 * Set the component3 from a Number object.
 * <br />/*from  w  ww.  java 2  s.  c om*/
 * <em>If the component being set is a fixed length number, the argument will not be 
 * padded.</em> It is recommended for these cases to use the setComponent3(String) 
 * method.
 * 
 * @see #setComponent3(String)
 *
 * @param component3 the Number with the component3 content to set
 */
public Field130 setComponent3(java.lang.Number component3) {
    if (component3 != null) {
        setComponent(3, "" + component3.intValue());
    }
    return this;
}

From source file:com.feilong.servlet.http.ResponseDownloadUtil.java

/**
 *  download response header.//  www .  j  a va2 s.c o m
 *
 * @param saveFileName
 *            the save file name
 * @param contentLength
 *            the content length
 * @param contentType
 *            ?,;,? <code>null</code>,,?? {@link #resolverContentType(String, String)}
 * @param contentDisposition
 *            ?,;,? <code>null</code>,,?? {@link #resolverContentDisposition(String, String)}
 * @param response
 *            the response
 */
private static void setDownloadResponseHeader(String saveFileName, Number contentLength, String contentType,
        String contentDisposition, HttpServletResponse response) {

    //response
    //getResponsegetWriter()??,??,?response.resetresetBuffer.
    //getOutputStream() has already been called for this response
    //jsp??,response.getOutputStream()??:java.lang.IllegalStateException:getOutputStream() has already been called for this response,Exception
    response.reset();

    //*************************************************************************
    response.addHeader(HttpHeaders.CONTENT_DISPOSITION,
            resolverContentDisposition(saveFileName, contentDisposition));

    // ===================== Default MIME Type Mappings =================== -->
    //??,?,????.????,???,
    response.setContentType(resolverContentType(saveFileName, contentType));

    if (isNotNullOrEmpty(contentLength)) {
        response.setContentLength(contentLength.intValue());
    }

    //************************about buffer***********************************************************

    //?:??,?,.
    //??,?:
    //JSP??
    //
    //JSPout.flush()response.flushbuffer()

    //:?,?,???,???.
    //XXX ?? response.setBufferSize(10240); ^_^

    //see org.apache.commons.io.IOUtils.copyLarge(InputStream, OutputStream) javadoc
    //This method buffers the input internally, so there is no need to use a BufferedInputStream
}

From source file:com.p5solutions.core.jpa.orm.ConversionUtilityImpl.java

/**
 * Convert number./*  w  w w  .  j  a va 2 s  .  c o  m*/
 * 
 * @param value
 *          the value
 * @param targetType
 *          the target type
 * @return the object
 * @throws TypeConversionException
 *           the type conversion exception
 */
private Object convertNumber(Number value, Class<?> targetType) throws TypeConversionException {
    if (ReflectionUtility.isBooleanClass(targetType)) {
        if (value.intValue() == 1) {
            return Boolean.TRUE;
        } else if (value.intValue() == 0) {
            return Boolean.FALSE;
        }

        throw new TypeConversionException("Unable to convert value of " + value + " to Boolean type!");

    } else if (ReflectionUtility.isShortClass(targetType)) {
        return NumberUtils.convertNumberToTargetClass(value, Short.class);
    } else if (ReflectionUtility.isIntegerClass(targetType)) {
        return NumberUtils.convertNumberToTargetClass(value, Integer.class);
    } else if (ReflectionUtility.isLongClass(targetType)) {
        return NumberUtils.convertNumberToTargetClass(value, Long.class);
    } else if (ReflectionUtility.isFloatClass(targetType)) {
        return NumberUtils.convertNumberToTargetClass(value, Float.class);
    } else if (ReflectionUtility.isDoubleClass(targetType)) {
        return NumberUtils.convertNumberToTargetClass(value, Double.class);
    } else if (ReflectionUtility.isBigDecimalClass(targetType)) {
        return NumberUtils.convertNumberToTargetClass(value, BigDecimal.class);
    } else if (ReflectionUtility.isBigIntegerClass(targetType)) {
        return NumberUtils.convertNumberToTargetClass(value, BigInteger.class);
    } else if (ReflectionUtility.isByteClass(targetType)) {
        return NumberUtils.convertNumberToTargetClass(value, Byte.class);
    }

    return value.intValue();
}