Example usage for java.lang Number longValue

List of usage examples for java.lang Number longValue

Introduction

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

Prototype

public abstract long longValue();

Source Link

Document

Returns the value of the specified number as a long .

Usage

From source file:de.swm.nis.logicaldecoding.dataaccess.ChangeSetFetcher.java

public long peek(String slotname) {
    //TODO this might be a VERY long running transaction in case of big updates (>10 Minutes), 
    //is this feasible? Are there better solutions? Is this really necessary?
    String sql = "SELECT count(*) from pg_logical_slot_peek_changes(?, NULL, NULL)";
    Number number = template.queryForObject(sql, new Object[] { slotname }, Long.class);
    return (number != null ? number.longValue() : 0);

}

From source file:org.springframework.social.yahoo.connect.YahooOAuth2Template.java

@SuppressWarnings("unused")
private AccessGrant extractAccessGrant(Map<String, Object> result) {
    String accessToken = (String) result.get("access_token");
    String scope = (String) result.get("scope");
    String tokenType = (String) result.get("token_type");
    // result.get("expires_in") may be an Integer, so cast it to Number first.    
    Number expiresInNumber = (Number) result.get("expires_in");
    Long expiresIn = (expiresInNumber == null) ? null : expiresInNumber.longValue();
    String refreshToken = (String) result.get("refresh_token");
    String xoauthYahooGuid = (String) result.get("xoauth_yahoo_guid");

    return createAccessGrant(accessToken, scope, refreshToken, expiresIn, result);
}

From source file:org.awesomeagile.webapp.security.google.GoogleConfigurableOAuth2Template.java

private AccessGrant extractAccessGrant(Map<String, Object> result) {
    String accessToken = (String) result.get("access_token");
    String scope = (String) result.get("scope");
    String refreshToken = (String) result.get("refresh_token");

    // result.get("expires_in") may be an Integer, so cast it to Number first.
    Number expiresInNumber = (Number) result.get("expires_in");
    Long expiresIn = (expiresInNumber == null) ? null : expiresInNumber.longValue();
    return createAccessGrant(accessToken, scope, refreshToken, expiresIn, result);
}

From source file:org.diorite.nbt.NbtTagLong.java

@Override
public void setNumberValue(final Number i) {
    this.value = i.longValue();
}

From source file:org.guzz.id.SequenceHiLoGenerator.java

public synchronized Number generate(WriteTranSession session, Object tableCondition) {
    if (maxLo < 1) {
        //keep the behavior consistent even for boundary usages
        Number n = (Number) super.nextSequenceValue(session, tableCondition);

        if (n.longValue() == 0L) {
            n = (Number) super.nextSequenceValue(session, tableCondition);
        }/*  ww  w  .  ja v a  2  s. c  o  m*/

        return IdentifierGeneratorFactory.createNumber(n.longValue(), this.returnType);
    }

    if (lo > maxLo) {
        Number n = (Number) super.nextSequenceValue(session, tableCondition);

        long hival = n.longValue();
        lo = (hival == 0) ? 1 : 0;
        hi = hival * (maxLo + 1);

        if (log.isDebugEnabled()) {
            log.debug("new hi value: " + hival);
        }
    }

    return IdentifierGeneratorFactory.createNumber(hi + lo++, this.returnType);
}

From source file:MutableLong.java

public void setValue(Number v) {
    this._value = v.longValue();
}

From source file:de.tor.tribes.util.bb.WinnerLoserStatsFormatter.java

private String formatValue(Number pValue, NumberFormat pFormatter) {
    return (pValue.longValue() >= 0) ? "+" + pFormatter.format(pValue) : pFormatter.format(pValue);
}

From source file:MutableLong.java

public void add(Number operand) {
    this._value += operand.longValue();
}

From source file:MutableLong.java

public void subtract(Number operand) {
    this._value -= operand.longValue();
}

From source file:com.bstek.dorado.data.variant.DefaultVariantConvertor.java

public long toLong(Object object) {
    Number n = (Number) longDateType.convertFromObject(object);
    return n.longValue();
}