@Override public long contentLength() { try { return contentLength != null ? Long.parseLong(contentLength) : -1; } catch (NumberFormatException e) { return -1; } }
@Override protected String doBackward(Long value) { return value.toString(); }
@Override public Long apply(Integer n) { return Long.valueOf(n); } };
public static long unboxed(Long v) { return v == null ? 0 : v.longValue(); }
private static BeanDefinition createScriptFactoryPostProcessor(boolean isRefreshable) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(ScriptFactoryPostProcessor.class); if (isRefreshable) { builder.addPropertyValue("defaultRefreshCheckDelay", new Long(1)); } return builder.getBeanDefinition(); }
private static int comparatorResult(Long result) { checkCondition( (result != null) && ((result == -1) || (result == 0) || (result == 1)), INVALID_FUNCTION_ARGUMENT, "Lambda comparator must return either -1, 0, or 1"); return result.intValue(); }
@Test public void lastModified() { ZonedDateTime now = ZonedDateTime.now(); String body = "foo"; Mono<EntityResponse<String>> result = EntityResponse.fromObject(body).lastModified(now).build(); Long expected = now.toInstant().toEpochMilli() / 1000; StepVerifier.create(result) .expectNextMatches(response -> expected.equals(response.headers().getLastModified() / 1000)) .expectComplete() .verify(); }
@Override public ReadableInstant convert(Long source) { return new DateTime(source.longValue()); } }
@Test public void contentLength() { String body = "foo"; Mono<EntityResponse<String>> result = EntityResponse.fromObject(body).contentLength(42).build(); StepVerifier.create(result) .expectNextMatches(response -> Long.valueOf(42).equals(response.headers().getContentLength())) .expectComplete() .verify(); }
public void testEqualsAndHashCode() { new EqualsTester() .addEqualityGroup(Optional.absent(), reserialize(Optional.absent())) .addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5)))) .addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42)))) .testEquals(); }
@Override public int getInt(String name) { return ((Long) decode(INTEGER, getFieldValue(name))).intValue(); }
@Test public void lastModified() { ZonedDateTime now = ZonedDateTime.now(); Mono<ServerResponse> result = ServerResponse.ok().lastModified(now).build(); Long expected = now.toInstant().toEpochMilli() / 1000; StepVerifier.create(result) .expectNextMatches(response -> expected.equals(response.headers().getLastModified() / 1000)) .expectComplete() .verify(); }
private static long stringToLong(String s) { if (s == null) return -1; try { return Long.parseLong(s); } catch (NumberFormatException e) { return -1; } }
@Override public void onPostCall(Long result) { // Handle the result of computation LOGGER.info(result.toString()); }
/** * Removes and returns the value associated with {@code key}. If {@code key} is not in the map, * this method has no effect and returns zero. */ @CanIgnoreReturnValue public long remove(K key) { Long result = map.remove(key); return (result == null) ? 0L : result.longValue(); }