Type argType=null;
if(strType!=null && strType.length()>0)
argType=nameToType(strType);
if(strArg==null || strArg.length()==0)
re=new ValueArg(strArg, argType);
else
{
int len=strArg.length();
char first=strArg.charAt(0);
char end=strArg.charAt(len-1);
//数值
if(Character.isDigit(first))
{
Type wrappedType=(argType == null ? null : SbmUtils.wrapType(argType));
if(Byte.class.equals(wrappedType))
{
re=new ValueArg(new Byte(strArg), argType);
}
else if(Short.class.equals(wrappedType))
{
re=new ValueArg(new Short(strArg), argType);
}
else if(Integer.class.equals(wrappedType))
{
re=new ValueArg(new Integer(strArg), argType);
}
else if(Long.class.equals(wrappedType))
{
re=new ValueArg(new Long(strArg), argType);
}
else if(Float.class.equals(wrappedType))
{
re=new ValueArg(new Float(strArg), argType);
}
else if(Double.class.equals(wrappedType))
{
re=new ValueArg(new Double(strArg), argType);
}
else if('L' == end)
{
re=new ValueArg(new Long(strArg.substring(0, len-1)), Long.class);
}
else if('l' == end)
{
re=new ValueArg(new Long(strArg.substring(0, len-1)), long.class);
}
else if('F' == end)
{
re=new ValueArg(new Float(strArg.substring(0, len-1)), Float.class);
}
else if('f'==end)
{
re=new ValueArg(new Float(strArg.substring(0, len-1)), float.class);
}
else if('D' == end)
{
re=new ValueArg(new Double(strArg.substring(0, len-1)), Double.class);
}
else if('d' == end)
{
re=new ValueArg(new Double(strArg.substring(0, len-1)), double.class);
}
else
{
boolean point=strArg.indexOf('.') >= 0;
if(point)
re=new ValueArg(new Double(strArg), argType);
else
re=new ValueArg(new Integer(strArg), argType);
}
}
else if(first =='"')
{
String ue=SbmUtils.unEscape(strArg);
len=ue.length();
if(len<2 || ue.charAt(len-1) != '"')
throw new ParseException("illegal String definition: "+strArg);
if(len == 2)
re=new ValueArg("", argType);
else
re=new ValueArg(ue.subSequence(1, len-1), argType);
}
else if(first =='\'')
{
String ue=SbmUtils.unEscape(strArg);
len=ue.length();
if(len!=3 || end!= '\'')
throw new ParseException("illegal char definition: "+strArg);
re=new ValueArg(ue.charAt(1), argType);
}
else if("true".equals(strArg))
{
re=new ValueArg(Boolean.TRUE, argType);
}
else if("false".equals(strArg))
{
re=new ValueArg(Boolean.FALSE, argType);
}
else if("null".equals(strArg))
{
re=new ValueArg(null, argType);
}
else
re=new KeyArg(strArg, argType);
}