Struts2中,下面一段代码中后面加了注释的那句是什么意思?
```publicObjectconvertValue(Mapcontext,Objectvalue,ClasstoType){if(toType==Locale.cla...
```
public Object convertValue(Map context, Object value, Class toType) {
if (toType == Locale.class ) {
System.out.println( " Converting String to Locale " );
String locale = ((String[]) value)[0];
return new Locale(locale.substring( 0 , 2 ), locale.substring( 3 )); //?
} else if (toType == String.class ) {
System.out.println( " Converting Locale to String " );
Locale locale = (Locale) value;
return locale.toString();
}
return null ;
}
``` 展开
public Object convertValue(Map context, Object value, Class toType) {
if (toType == Locale.class ) {
System.out.println( " Converting String to Locale " );
String locale = ((String[]) value)[0];
return new Locale(locale.substring( 0 , 2 ), locale.substring( 3 )); //?
} else if (toType == String.class ) {
System.out.println( " Converting Locale to String " );
Locale locale = (Locale) value;
return locale.toString();
}
return null ;
}
``` 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询