本文整理汇总了Java中com.threewks.gaetools.transformer.numeric.StringToLong类的典型用法代码示例。如果您正苦于以下问题:Java StringToLong类的具体用法?Java StringToLong怎么用?Java StringToLong使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringToLong类属于com.threewks.gaetools.transformer.numeric包,在下文中一共展示了StringToLong类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldReturnTransformerForBasicTypeIfBoxedTypeTransformerRegistered
import com.threewks.gaetools.transformer.numeric.StringToLong; //导入依赖的package包/类
@Test
public void shouldReturnTransformerForBasicTypeIfBoxedTypeTransformerRegistered() {
assertThat(transformerManager.getTransformer(String.class, Long.class), is(nullValue()));
assertThat(transformerManager.getTransformer(String.class, long.class), is(nullValue()));
assertThat(transformerManager.getTransformer(Long.class, String.class), is(nullValue()));
assertThat(transformerManager.getTransformer(long.class, String.class), is(nullValue()));
transformerManager.register(String.class, Long.class, new StringToLong());
assertThat(transformerManager.getTransformer(String.class, Long.class), is(notNullValue()));
assertThat(transformerManager.getTransformer(String.class, long.class), is(notNullValue()));
transformerManager.register(Long.class, String.class, new LongToString());
assertThat(transformerManager.getTransformer(Long.class, String.class), is(notNullValue()));
assertThat(transformerManager.getTransformer(long.class, String.class), is(notNullValue()));
}
示例2: shouldGetTransformerSafeForRegisteredType
import com.threewks.gaetools.transformer.numeric.StringToLong; //导入依赖的package包/类
@Test
public void shouldGetTransformerSafeForRegisteredType() {
StringToLong transformer = new StringToLong();
transformerManager.register(String.class, Long.class, transformer);
assertThat(transformerManager.getTransformerSafe(String.class, Long.class), is((ETransformer<String, Long>) transformer));
}
示例3: shouldTransformGivenObject
import com.threewks.gaetools.transformer.numeric.StringToLong; //导入依赖的package包/类
@Test
public void shouldTransformGivenObject() {
StringToLong registered = new StringToLong();
transformerManager.register(String.class, Long.class, registered);
assertThat(transformerManager.transform(String.class, Long.class, "1"), is(1L));
assertThat(transformerManager.transform(String.class, Number.class, "1"), is((Number) 1L));
}
示例4: shouldTransformAllGivenObjects
import com.threewks.gaetools.transformer.numeric.StringToLong; //导入依赖的package包/类
@Test
public void shouldTransformAllGivenObjects() {
StringToLong registered = new StringToLong();
transformerManager.register(String.class, Long.class, registered);
assertThat(transformerManager.transformAll(String.class, Long.class, list("1", "2")), is(list(1L, 2L)));
assertThat(transformerManager.transformAll(String.class, Number.class, list("1", "2")), is(list((Number) 1L, (Number) 2L)));
}
示例5: shouldCopyTransformerRetainingRegisteredTransformers
import com.threewks.gaetools.transformer.numeric.StringToLong; //导入依赖的package包/类
@Test
public void shouldCopyTransformerRetainingRegisteredTransformers() {
StringToLong transformer = new StringToLong();
LongToString transformer2 = new LongToString();
transformerManager.register(String.class, Long.class, transformer);
transformerManager.register(Long.class, String.class, transformer2);
TransformerManager copy = transformerManager.copy();
assertThat(copy, is(not(sameInstance(transformerManager))));
assertThat(copy.getTransformer(String.class, Long.class), is((ETransformer<String, Long>) transformer));
assertThat(copy.getTransformer(Long.class, String.class), is((ETransformer<Long, String>) transformer2));
}
示例6: createWithDefaults
import com.threewks.gaetools.transformer.numeric.StringToLong; //导入依赖的package包/类
public static TransformerManager createWithDefaults() {
TransformerManager transformerManager = createEmpty();
// numeric types
transformerManager.register(String.class, Byte.class, new StringToByte());
transformerManager.register(String.class, Integer.class, new StringToInteger());
transformerManager.register(String.class, Long.class, new StringToLong());
transformerManager.register(String.class, Short.class, new StringToShort());
transformerManager.register(String.class, Float.class, new StringToFloat());
transformerManager.register(String.class, Double.class, new StringToDouble());
transformerManager.register(String.class, BigDecimal.class, new StringToBigDecimal());
transformerManager.register(String.class, BigInteger.class, new StringToBigInteger());
transformerManager.register(String.class, Number.class, new StringToNumber());
transformerManager.register(Byte.class, String.class, new ByteToString());
transformerManager.register(Long.class, String.class, new LongToString());
transformerManager.register(Long.class, BigDecimal.class, new LongToBigDecimal());
transformerManager.register(Integer.class, String.class, new IntegerToString());
transformerManager.register(Integer.class, BigDecimal.class, new IntegerToBigDecimal());
transformerManager.register(Short.class, String.class, new ShortToString());
transformerManager.register(Double.class, String.class, new DoubleToString());
transformerManager.register(Double.class, BigDecimal.class, new DoubleToBigDecimal());
transformerManager.register(Float.class, String.class, new FloatToString());
transformerManager.register(Float.class, BigDecimal.class, new FloatToBigDecimal());
transformerManager.register(BigDecimal.class, String.class, new BigDecimalToString());
transformerManager.register(BigInteger.class, String.class, new BigIntegerToString());
transformerManager.register(Number.class, String.class, new NumberToString());
transformerManager.register(Number.class, Float.class, new NumberToFloat());
transformerManager.register(Number.class, Double.class, new NumberToDouble());
transformerManager.register(Number.class, Integer.class, new NumberToInteger());
transformerManager.register(Number.class, Long.class, new NumberToLong());
transformerManager.register(Number.class, Short.class, new NumberToShort());
transformerManager.register(Number.class, BigInteger.class, new NumberToBigInteger());
transformerManager.register(Number.class, BigDecimal.class, new NumberToBigDecimal());
transformerManager.register(Number.class, AtomicInteger.class, new NumberToAtomicInteger());
transformerManager.register(Number.class, AtomicLong.class, new NumberToAtomicLong());
// string/character types
transformerManager.register(Character.class, String.class, new CharToString());
transformerManager.register(String.class, Character.class, new StringToChar());
// date types
transformerManager.register(String.class, DateTime.class, new StringToDateTime());
transformerManager.register(String.class, Date.class, new StringToDate());
transformerManager.register(String.class, ReadableInstant.class, new StringToReadableInstant());
transformerManager.register(DateTime.class, String.class, new DateTimeToString());
transformerManager.register(DateTime.class, Long.class, new DateTimeToLong());
transformerManager.register(DateTime.class, BigDecimal.class, new DateTimeToBigDecimal());
transformerManager.register(DateTime.class, Date.class, new DateTimeToDate());
transformerManager.register(Date.class, String.class, new DateToString());
transformerManager.register(Date.class, DateTime.class, new DateToDateTime());
transformerManager.register(Date.class, Long.class, new DateToLong());
transformerManager.register(ReadableInstant.class, String.class, new ReadableInstantToString());
transformerManager.register(ReadableInstant.class, Long.class, new ReadableInstantToLong());
transformerManager.register(ReadableInstant.class, Date.class, new ReadableInstantToDate());
transformerManager.register(Object.class, DateTime.class, new ObjectToDateTime());
transformerManager.register(Long.class, DateTime.class, new LongToDateTime());
transformerManager.register(BigDecimal.class, DateTime.class, new BigDecimalToDateTime());
transformerManager.register(Long.class, Date.class, new LongToDate());
// discrete types
transformerManager.register(Boolean.class, String.class, new BooleanToString());
transformerManager.register(Enum.class, String.class, new EnumToString());
transformerManager.register(String.class, Boolean.class, new StringToBoolean());
// url types
transformerManager.register(URL.class, String.class, new UrlToString());
transformerManager.register(URI.class, String.class, new UriToString());
transformerManager.register(String.class, URL.class, new StringToUrl());
transformerManager.register(String.class, URI.class, new StringToUri());
// uuids
transformerManager.register(UUID.class, String.class, new UUIDToString());
transformerManager.register(String.class, UUID.class, new StringToUUID());
// data types
transformerManager.register(byte[].class, InputStream.class, new ByteArrayToInputStream());
transformerManager.register(String.class, InputStream.class, new StringToInputStream());
transformerManager.register(InputStream.class, byte[].class, new InputStreamToByteArray());
return transformerManager;
}
示例7: shouldGetTransformForRegisteredType
import com.threewks.gaetools.transformer.numeric.StringToLong; //导入依赖的package包/类
@Test
public void shouldGetTransformForRegisteredType() {
StringToLong transformer = new StringToLong();
assertThat(transformerManager.getTransformer(String.class, Long.class), is(nullValue()));
transformerManager.register(String.class, Long.class, transformer);
assertThat(transformerManager.getTransformer(String.class, Long.class), is((ETransformer<String, Long>) transformer));
}