Java Code Examples for org.stringtemplate.v4.STGroup#DICT_KEY

The following examples show how to use org.stringtemplate.v4.STGroup#DICT_KEY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 2
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 3
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 4
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 5
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 6
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 7
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 8
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 9
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 10
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 11
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 12
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 13
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 14
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 15
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 16
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}
 
Example 17
Source File: MapModelAdaptor.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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;
}