Example usage for java.lang Long toString

List of usage examples for java.lang Long toString

Introduction

In this page you can find the example usage for java.lang Long toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Long 's value.

Usage

From source file:cherry.foundation.crypto.SecureLongEncoderTest.java

@Test
public void testSecureLong() throws Exception {
    SecureLong.setEncoder(createSecureLongEncoder());
    for (int i = 0; i < 100; i++) {

        Long plain = Long.valueOf(random.nextInt());
        SecureLong ss0 = SecureLong.plainValueOf(plain);
        assertThat(ss0.plain(), is(plain));
        assertThat(ss0.crypto(), is(not(plain.toString())));

        SecureLong ss1 = SecureLong.cryptoValueOf(ss0.crypto());
        assertThat(ss1.plain(), is(plain));
        assertThat(ss1.crypto(), is(ss0.crypto()));

        SecureLong ss2 = SecureLong.plainValueOf(ss1.plain());
        assertThat(ss2.plain(), is(plain));
        assertThat(ss2.crypto(), is(ss0.crypto()));

        SecureLong ss3 = SecureLong.cryptoValueOf(ss2.crypto());
        assertThat(ss3.plain(), is(plain));
        assertThat(ss3.crypto(), is(ss0.crypto()));
    }/*w  ww . j  a v  a2s.  co  m*/
}

From source file:com.nesscomputing.mojo.numbers.NumberField.java

public void setNumberValue(final Long value) {
    parse();//from w  ww.  j  ava 2s  . c om
    if (!numberElements.isEmpty()) {
        elements.set(numberElements.get(numberDefinition.getFieldNumber()), value.toString());
        valueProvider.setValue(StringUtils.join(elements, null));
    }
}

From source file:greensopinion.restexample.web.BlogServiceClient.java

@Override
public Article getArticle(Long articleId) {
    Map<String, String> variables = new HashMap<String, String>();
    variables.put("articleId", articleId.toString());
    Result result = template.getForObject(computeUrl("article/{articleId}"), Result.class, variables);
    if (result.getArticle() != null) {
        return result.getArticle();
    }//from w w w .  jav  a 2  s .c  o  m
    throw new IllegalStateException("Unexpected result");
}

From source file:com.google.code.ssm.test.dao.TestDAOImpl.java

@Override
@UpdateSingleCache(namespace = CacheConst.BRAVO, expiration = 300)
@ReturnDataUpdateContent/*ww w .  j  a  v  a  2 s. c o  m*/
public String updateTimestampValue(@ParameterValueKeyProvider final Long key) {
    try {
        Thread.sleep(100);
    } catch (InterruptedException ex) {
    }
    final Long now = new Date().getTime();
    return now.toString() + "-U-" + key.toString();
}

From source file:models.dao.OldSensorReadingDaoImplementation.java

@Override
public boolean addReading(String deviceId, Long timeStamp, String sensorType, Double value) {
    final String SQL = "INSERT INTO CMU.CMU_SENSOR (DEVICEID, TIMESTAMP, SENSORTYPE, VALUE)" + "VALUES ('"
            + deviceId + "','" + timeStamp.toString() + "','" + sensorType + "','" + value.toString() + "')";
    try {/*w  ww  .  j a va 2 s . c om*/
        simpleJdbcTemplate.update(SQL);
    } catch (Exception e) {
        return false;
    }
    return true;
}

From source file:com.threew.validacion.tarjetas.credito.utilidad.Validador.java

public Validador(Long numero) {
    this.numeroTarjetaLong = numero;
    this.numeroTarjetaString = numero.toString();
}

From source file:edu.harvard.iq.dataverse.authorization.MyDataQueryHelperServiceBean.java

private String getRoleIdListClause(List<Long> roleIdList) {
    if (roleIdList == null) {
        return "";
    }/*from  w  ww.  j  a  va  2s.  c  om*/
    List<String> outputList = new ArrayList<>();

    for (Long r : roleIdList) {
        if (r != null) {
            outputList.add(r.toString());
        }
    }
    if (outputList.isEmpty()) {
        return "";
    }
    return " AND role.role_id IN (" + StringUtils.join(outputList, ",") + ")";
}

From source file:greensopinion.restexample.web.BlogServiceClient.java

@Override
public List<Article> listArticles(Long blogId, Date since) {
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("blogId", blogId.toString());
    variables.put("since", dateFormat.format(since));
    Result result = template.getForObject(computeUrl("blog/{blogId}/articles/{since}"), Result.class,
            variables);//  w w  w  .  ja  va 2  s.co  m
    if (result.getArticleList() != null) {
        return result.getArticleList();
    }
    throw new IllegalStateException("Unexpected result");
}

From source file:org.flite.cach3.test.UpdateMultiCacheTest.java

@Test
public void testVelocity() {

    final String original = RandomStringUtils.randomAlphanumeric(7);
    final Long second = Long.valueOf("1337" + RandomStringUtils.randomNumeric(5));
    final List<Long> firsts = new ArrayList<Long>();
    final List<String> baseIds = new ArrayList<String>();
    final long base = RandomUtils.nextInt(2000) + 1000;
    for (int ix = 0; ix < 3; ix++) {
        final Long val = base + ix;
        firsts.add(val);
        baseIds.add(val + "&&" + second);
    }/* w ww.  j a va2 s .co m*/
    final Long extra = base + 10;
    final String extraString = original + extra.toString();

    final TestSvc test = (TestSvc) context.getBean("testSvc");
    final StubUpdateMultiCacheListenerImpl listener = (StubUpdateMultiCacheListenerImpl) context
            .getBean("stubUM");

    final int previous = listener.getTriggers().size();
    final List<String> results = test.updateCompoundStrings(second, original, firsts);

    // Testing that the listener got invoked as required.
    assertTrue("Doesn't look like the listener got called.", listener.getTriggers().size() == previous + 1);
    final String expected = StubUpdateMultiCacheListenerImpl.formatTriggers(TestDAOImpl.COMPOUND_NAMESPACE,
            TestDAOImpl.COMPOUND_PREFIX, baseIds, (List<Object>) (List) results, // Using Erasure to satisfy the compiler. YUCK!
            results, new Object[] { second, original, firsts });
    assertEquals(expected, listener.getTriggers().get(listener.getTriggers().size() - 1));

    // This part just double-checks the sublist aspect of the ReadThroughMultiCache
    firsts.add(extra);
    Collections.shuffle(firsts);
    final List<String> r2 = test.getCompoundStrings(firsts, extraString, second);
    for (int ix = 0; ix < firsts.size(); ix++) {
        final Long value = firsts.get(ix);
        assertEquals(value.equals(extra) ? extraString : original, r2.get(ix));
    }
}

From source file:com.epam.catgenome.entity.track.Track.java

public String proteinCacheKey(final Long referenceId) {
    String myCacheKey = myCacheKey();
    if (StringUtils.isEmpty(myCacheKey) || referenceId == null) {
        return null;
    }//from  www.jav a  2 s  .  co m
    return myCacheKey + referenceId.toString();
}