本文整理汇总了Java中org.stringtemplate.v4.STGroup.DICT_KEY属性的典型用法代码示例。如果您正苦于以下问题:Java STGroup.DICT_KEY属性的具体用法?Java STGroup.DICT_KEY怎么用?Java STGroup.DICT_KEY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.stringtemplate.v4.STGroup
的用法示例。
在下文中一共展示了STGroup.DICT_KEY属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProperty
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
Object value;
Map<?, ?> map = (Map<?, ?>)o;
if ( property==null ) value = map.get(STGroup.DEFAULT_KEY);
else if ( property.equals("keys") ) value = map.keySet();
else if ( property.equals("values") ) value = map.values();
else if ( map.containsKey(property) ) value = map.get(property);
else if ( map.containsKey(propertyName) ) { // if can't find the key, try toString version
value = map.get(propertyName);
}
else value = map.get(STGroup.DEFAULT_KEY); // not found, use default
if ( value==STGroup.DICT_KEY ) {
value = property;
}
return value;
}
示例2: getProperty
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
Object value;
Map<?, ?> map = (Map<?, ?>)o;
if ( property==null ) value = map.get(STGroup.DEFAULT_KEY);
else if ( property.equals("keys") ) value = map.keySet();
else if ( property.equals("values") ) value = map.values();
else if ( map.containsKey(property) ) value = map.get(property);
else if ( map.containsKey(propertyName) ) { // if can't find the key, try toString version
value = map.get(propertyName);
}
else value = map.get(STGroup.DEFAULT_KEY); // not found, use default
if ( value==STGroup.DICT_KEY ) {
value = property;
}
return value;
}
示例3: getProperty
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName)
throws STNoSuchPropertyException
{
Object value;
Map<?, ?> map = (Map<?, ?>)o;
if ( property==null ) value = map.get(STGroup.DEFAULT_KEY);
else if ( property.equals("keys") ) value = map.keySet();
else if ( property.equals("values") ) value = map.values();
else if ( map.containsKey(property) ) value = map.get(property);
else if ( map.containsKey(propertyName) ) { // if can't find the key, try toString version
value = map.get(propertyName);
}
else value = map.get(STGroup.DEFAULT_KEY); // not found, use default
if ( value == STGroup.DICT_KEY ) {
value = property;
}
return value;
}