test_class.file: step-core-model/src/test/java/step/core/dynamicbeans/ValueConverterTest.java
test_class.identifier: ValueConverterTest
test_case.body: @Test
  	public void test() {
  		Object value;
  		
  		// string to long
  		value = ValueConverter.convert("1", Long.class);
  		assertEquals(Long.class, value.getClass());
  		assertEquals(1, (long) value);
  		
  		// long to long
  		value = ValueConverter.convert(1l, Long.class);
  		assertEquals(Long.class, value.getClass());
  		assertEquals(1, (long) value);
  		
  		// int to long
  		value = ValueConverter.convert(1, Long.class);
  		assertEquals(Long.class, value.getClass());
  		assertEquals(1, (long) value);
  		
  		// double to long
  		value = ValueConverter.convert(1.1, Long.class);
  		assertEquals(Long.class, value.getClass());
  		assertEquals(1, (long) value);
  		
  		// string to int
  		value = ValueConverter.convert("1", Integer.class);
  		assertEquals(Integer.class, value.getClass());
  		assertEquals(1, (int) value);
  		
  		// int to int
  		value = ValueConverter.convert(1, Integer.class);
  		assertEquals(Integer.class, value.getClass());
  		assertEquals(1, (int) value);
  		
  		// string to int
  		value = ValueConverter.convert("1", String.class);
  		assertEquals(String.class, value.getClass());
  		assertEquals("1", value);
  	}
test_case.class_method_signature: ValueConverterTest.test()
test_case.full_signature: @Test public void test()
test_case.identifier: test
test_case.invocations: convert assertEquals getClass assertEquals convert assertEquals getClass assertEquals convert assertEquals getClass assertEquals convert assertEquals getClass assertEquals convert assertEquals getClass assertEquals convert assertEquals getClass assertEquals convert assertEquals getClass assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test()
focal_class.file: step-core-model/src/main/java/step/core/dynamicbeans/ValueConverter.java
focal_class.identifier: ValueConverter
focal_class.class_method_signature: ValueConverter.convert(Object value, Class<T> classTo)
focal_class.full_signature: @SuppressWarnings("unchecked") public static T convert(Object value, Class<T> classTo)
focal_class.identifier: convert
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (Object value, Class<T> classTo)
focal_class.return: T
focal_class.signature: T convert(Object value, Class<T> classTo)
focal_class.class_method_signature: ValueConverter.unsupportedConversionException(Class<?> class_, Object value)
focal_class.full_signature: protected static RuntimeException unsupportedConversionException(Class<?> class_, Object value)
focal_class.identifier: unsupportedConversionException
focal_class.modifiers: protected static
focal_class.parameters: (Class<?> class_, Object value)
focal_class.return: RuntimeException
focal_class.signature: RuntimeException unsupportedConversionException(Class<?> class_, Object value)
focal_method.body: @SuppressWarnings("unchecked")
  	public static <T> T convert(Object value, Class<T> classTo) {
  		if(value != null) {
  			if(String.class.isAssignableFrom(classTo)) {
  				return (T) value.toString();
  			} else if(Long.class.isAssignableFrom(classTo)) {
  				if(value instanceof Number) {
  					return (T)new Long(((Number)value).longValue());
  				} else if(value instanceof String){
  					return (T)new Long(Long.parseLong((String)value));
  				} else {
  					throw unsupportedConversionException(classTo, value);
  				}
  			} else if(Integer.class.isAssignableFrom(classTo)) {
  				if(value instanceof Number) {
  					return (T)new Integer(((Number)value).intValue());
  				} else if(value instanceof String){
  					return (T)new Integer(Integer.parseInt((String)value));
  				} else {
  					throw unsupportedConversionException(classTo, value);
  				}
  			} else {
  				throw unsupportedConversionException(classTo, value);
  			}
  		} else {
  			return null;
  		}
  	}
focal_method.class_method_signature: ValueConverter.convert(Object value, Class<T> classTo)
focal_method.full_signature: @SuppressWarnings("unchecked") public static T convert(Object value, Class<T> classTo)
focal_method.identifier: convert
focal_method.invocations: isAssignableFrom toString isAssignableFrom longValue parseLong unsupportedConversionException isAssignableFrom intValue parseInt unsupportedConversionException unsupportedConversionException
focal_method.modifiers: @SuppressWarnings("unchecked") public static
focal_method.parameters: (Object value, Class<T> classTo)
focal_method.return: T
focal_method.signature: T convert(Object value, Class<T> classTo)