code: static
  	private Integer toInteger(Object value){
  
  		if(value instanceof Integer){
  			return (Integer)value;
  		} else
  
  		if((value instanceof Double) || (value instanceof Float)){
  			Number number = (Number)value;
  
  			if(DoubleMath.isMathematicalInteger(number.doubleValue())){
  				return toInteger(number.longValue());
  			}
  		} else
  
  		if(value instanceof Long){
  			Long number = (Long)value;
  
  			return toInteger(number.longValue());
  		} else
  
  		if((value instanceof Short) || (value instanceof Byte)){
  			Number number = (Number)value;
  
  			return Integer.valueOf(number.intValue());
  		} else
  
  		if(value instanceof Boolean){
  			Boolean flag = (Boolean)value;
  
  			return (flag.booleanValue() ? Numbers.INTEGER_ONE : Numbers.INTEGER_ZERO);
  		} else
  
  		if((value instanceof DaysSinceDate) || (value instanceof SecondsSinceDate) || (value instanceof SecondsSinceMidnight)){
  			Number number = (Number)value;
  
  			return Integer.valueOf(number.intValue());
  		}
  
  		throw new TypeCheckException(DataType.INTEGER, value);
  	}
docs: <p>
  Casts the specified value to Integer data type.
  </p>
  
  @see DataType#INTEGER