src/main/java/com/mxgraph/io/mxObjectCodec.java
protected Object convertValueFromXml(Class<?> type, Object value)
	{
		if (value instanceof String)
		{
			String tmp = (String) value;

			if (type.equals(boolean.class) || type == Boolean.class)
			{
				if (tmp.equals("1") || tmp.equals("0"))
				{
					tmp = (tmp.equals("1")) ? "true" : "false";
				}

				value = Boolean.valueOf(tmp);
			}
			else if (type.equals(char.class) || type == Character.class)
			{
				value = Character.valueOf(tmp.charAt(0));
			}
			else if (type.equals(byte.class) || type == Byte.class)
			{
				value = Byte.valueOf(tmp);
			}
			else if (type.equals(short.class) || type == Short.class)
			{
				value = Short.valueOf(tmp);
			}
			else if (type.equals(int.class) || type == Integer.class)
			{
				value = Integer.valueOf(tmp);
			}
			else if (type.equals(long.class) || type == Long.class)
			{
				value = Long.valueOf(tmp);
			}
			else if (type.equals(float.class) || type == Float.class)
			{
				value = Float.valueOf(tmp);
			}
			else if (type.equals(double.class) || type == Double.class)
			{
				value = Double.valueOf(tmp);
			}
		}

		return value;
	}
/**
	 * Converts XML attribute values to object of the given type.
	 */
Converts XML attribute values to object of the given type.
Converts XML attribute values to object of the given type .
protected Object convertValueFromXml(Class<?> type, Object value)
	{
		if (value instanceof String)
		{
			String tmp = (String) value;
			if (type.equals(boolean.class) || type == Boolean.class)
			{
				if (tmp.equals("1") || tmp.equals("0"))
				{
					tmp = (tmp.equals("1")) ? "true" : "false";
				}
				value = Boolean.valueOf(tmp);
			}
			else if (type.equals(char.class) || type == Character.class)
			{
				value = Character.valueOf(tmp.charAt(0));
			}
			else if (type.equals(byte.class) || type == Byte.class)
			{
				value = Byte.valueOf(tmp);
			}
			else if (type.equals(short.class) || type == Short.class)
			{
				value = Short.valueOf(tmp);
			}
			else if (type.equals(int.class) || type == Integer.class)
			{
				value = Integer.valueOf(tmp);
			}
			else if (type.equals(long.class) || type == Long.class)
			{
				value = Long.valueOf(tmp);
			}
			else if (type.equals(float.class) || type == Float.class)
			{
				value = Float.valueOf(tmp);
			}
			else if (type.equals(double.class) || type == Double.class)
			{
				value = Double.valueOf(tmp);
			}
		}
		return value;
	}
protected Object convertValueFromXml ( Class < ? > type , Object value ) { if ( value instanceof String ) { String tmp = ( String ) value ; if ( type . equals ( boolean . class ) || type == Boolean . class ) { if ( tmp . equals ( "1" ) || tmp . equals ( "0" ) ) { tmp = ( tmp . equals ( "1" ) ) ? "true" : "false" ; } value = Boolean . valueOf ( tmp ) ; } else if ( type . equals ( char . class ) || type == Character . class ) { value = Character . valueOf ( tmp . charAt ( 0 ) ) ; } else if ( type . equals ( byte . class ) || type == Byte . class ) { value = Byte . valueOf ( tmp ) ; } else if ( type . equals ( short . class ) || type == Short . class ) { value = Short . valueOf ( tmp ) ; } else if ( type . equals ( int . class ) || type == Integer . class ) { value = Integer . valueOf ( tmp ) ; } else if ( type . equals ( long . class ) || type == Long . class ) { value = Long . valueOf ( tmp ) ; } else if ( type . equals ( float . class ) || type == Float . class ) { value = Float . valueOf ( tmp ) ; } else if ( type . equals ( double . class ) || type == Double . class ) { value = Double . valueOf ( tmp ) ; } } return value ; }
Converts XML attribute values to object of the given type.
Converts XML attribute values to object of the given type .