My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CPELType  
Updated Aug 8, 2010 by jind...@gmail.com

默认类型转换支持

命令行解析过程中,输入永远只能是字符串,而且不能是空字符串,也不能为null,类型转换的功能就是吧这些输入字符串转化为需要的特定类型。

  • 类型转换
    1. 数值类型(Long,Integer,Double,Short,Byte,long,int,double,short,byte)
      1. 调用相关的解析函数(如:Double.parseDouble(value))
    2. 布尔类型(Boolean,boolean)
      1. 对于"true","false",返回相关boolean 值true,false
      2. 打印警告日志(非标准boolean字面量)
      3. 对于"","0","0.0","FALSE"(大小写不敏感)为false,其他值均为true
    3. 字符串(String)
    4. 不需要转换
    5. 字符(char,Character)
    6. 取第一个字符
    7. Object
    8. 当String返回,不转换
    9. 资源对象(File, URL, URI)
    10. 调用他的字符串参数构造器:
      ...
      new File(String path);
      ...
      new URL(String path);
      ...
      new URI(String path);

Sign in to add a comment
Powered by Google Project Hosting