/** * Find an attribute via dynamic scoping up enclosing scope chain. Only look * for a dictionary definition if the attribute is not found, so attributes * sent in to a template override dictionary names. * <p> * Return {@link ST#EMPTY_ATTR} if found definition but no value.</p> */ public Object getAttribute(InstanceScope scope, String name) { InstanceScope current = scope; while ( current!=null ) { ST p = current.st; FormalArgument localArg = null; if ( p.impl.formalArguments!=null ) localArg = p.impl.formalArguments.get(name); if ( localArg!=null ) { Object o = p.locals[localArg.index]; return o; } current = current.parent; // look up enclosing scope chain } // got to root scope and no definition, try dictionaries in group and up final ST self = scope.st; STGroup g = self.impl.nativeGroup; Object o = getDictionary(g, name); if ( o!=null ) return o; // not found, report unknown attr throw new STNoSuchAttributeException(name, scope); }
/** * Find an attribute via dynamic scoping up enclosing scope chain. Only look * for a dictionary definition if the attribute is not found, so attributes * sent in to a template override dictionary names. * <p> * Return {@link ST#EMPTY_ATTR} if found definition but no value.</p> */ public Object getAttribute(InstanceScope scope, String name) { InstanceScope current = scope; while ( current!=null ) { ST p = current.st; FormalArgument localArg = null; if ( p.impl.formalArguments!=null ) localArg = p.impl.formalArguments.get(name); if ( localArg!=null ) { Object o = p.locals[localArg.index]; return o; } current = current.parent; // look up enclosing scope chain } // got to root scope and no definition, try dictionaries in group and up final ST self = scope.st; STGroup g = self.impl.nativeGroup; Object o = getDictionary(g, name); if ( o!=null ) return o; // not found, report unknown attr throw new STNoSuchAttributeException(name, scope); }
/** * Find an attribute via dynamic scoping up enclosing scope chain. Only look * for a dictionary definition if the attribute is not found, so attributes * sent in to a template override dictionary names. * <p> * Return {@link ST#EMPTY_ATTR} if found definition but no value.</p> */ public Object getAttribute(InstanceScope scope, String name) { InstanceScope current = scope; while ( current!=null ) { ST p = current.st; FormalArgument localArg = null; if ( p.impl.formalArguments!=null ) localArg = p.impl.formalArguments.get(name); if ( localArg!=null ) { Object o = p.locals[localArg.index]; return o; } current = current.parent; // look up enclosing scope chain } // got to root scope and no definition, try dictionaries in group and up final ST self = scope.st; STGroup g = self.impl.nativeGroup; Object o = getDictionary(g, name); if ( o!=null ) return o; // not found, report unknown attr throw new STNoSuchAttributeException(name, scope); }
/** * Find an attribute via dynamic scoping up enclosing scope chain. Only look * for a dictionary definition if the attribute is not found, so attributes * sent in to a template override dictionary names. * <p> * Return {@link ST#EMPTY_ATTR} if found definition but no value.</p> */ public Object getAttribute(InstanceScope scope, String name) { InstanceScope current = scope; while ( current!=null ) { ST p = current.st; FormalArgument localArg = null; if ( p.impl.formalArguments!=null ) localArg = p.impl.formalArguments.get(name); if ( localArg!=null ) { Object o = p.locals[localArg.index]; return o; } current = current.parent; // look up enclosing scope chain } // got to root scope and no definition, try dictionaries in group and up final ST self = scope.st; STGroup g = self.impl.nativeGroup; Object o = getDictionary(g, name); if ( o!=null ) return o; // not found, report unknown attr throw new STNoSuchAttributeException(name, scope); }
/** * Find an attribute via dynamic scoping up enclosing scope chain. Only look * for a dictionary definition if the attribute is not found, so attributes * sent in to a template override dictionary names. * <p> * Return {@link ST#EMPTY_ATTR} if found definition but no value.</p> */ public Object getAttribute(InstanceScope scope, String name) { InstanceScope current = scope; while ( current!=null ) { ST p = current.st; FormalArgument localArg = null; if ( p.impl.formalArguments!=null ) localArg = p.impl.formalArguments.get(name); if ( localArg!=null ) { Object o = p.locals[localArg.index]; return o; } current = current.parent; // look up enclosing scope chain } // got to root scope and no definition, try dictionaries in group and up final ST self = scope.st; STGroup g = self.impl.nativeGroup; Object o = getDictionary(g, name); if ( o!=null ) return o; // not found, report unknown attr throw new STNoSuchAttributeException(name, scope); }
/** Find an attr via dynamic scoping up enclosing scope chain. * If not found, look for a map. So attributes sent in to a template * override dictionary names. * * return EMPTY_ATTR if found def but no value */ public Object getAttribute(ST self, String name) { InstanceScope scope = currentScope; while ( scope!=null ) { ST p = scope.st; FormalArgument localArg = null; if ( p.impl.formalArguments!=null ) localArg = p.impl.formalArguments.get(name); if ( localArg!=null ) { Object o = p.locals[localArg.index]; return o; } scope = scope.parent; // look up enclosing scope chain } // got to root scope and no definition, try dictionaries in group and up STGroup g = self.impl.nativeGroup; Object o = getDictionary(g, name); if ( o!=null ) return o; // not found, report unknown attr if ( ST.cachedNoSuchAttrException ==null ) { ST.cachedNoSuchAttrException = new STNoSuchAttributeException(); } ST.cachedNoSuchAttrException.name = name; ST.cachedNoSuchAttrException.scope = currentScope; throw ST.cachedNoSuchAttrException; }
/** * Find an attribute via dynamic scoping up enclosing scope chain. Only look * for a dictionary definition if the attribute is not found, so attributes * sent in to a template override dictionary names. * <p> * Return {@link ST#EMPTY_ATTR} if found definition but no value.</p> */ public Object getAttribute(InstanceScope scope, String name) { InstanceScope current = scope; while ( current!=null ) { ST p = current.st; FormalArgument localArg = null; if ( p.impl.formalArguments!=null ) localArg = p.impl.formalArguments.get(name); if ( localArg!=null ) { Object o = p.locals[localArg.index]; return o; } current = current.parent; // look up enclosing scope chain } // got to root scope and no definition, try dictionaries in group and up final ST self = scope.st; STGroup g = self.impl.nativeGroup; Object o = getDictionary(g, name); if ( o!=null ) return o; // not found, report unknown attr throw new STNoSuchAttributeException(name, scope); }
/** * Find an attribute via dynamic scoping up enclosing scope chain. Only look * for a dictionary definition if the attribute is not found, so attributes * sent in to a template override dictionary names. * <p> * Return {@link ST#EMPTY_ATTR} if found definition but no value.</p> */ public Object getAttribute(InstanceScope scope, String name) { InstanceScope current = scope; while ( current!=null ) { ST p = current.st; FormalArgument localArg = null; if ( p.impl.formalArguments!=null ) localArg = p.impl.formalArguments.get(name); if ( localArg!=null ) { Object o = p.locals[localArg.index]; return o; } current = current.parent; // look up enclosing scope chain } // got to root scope and no definition, try dictionaries in group and up final ST self = scope.st; STGroup g = self.impl.nativeGroup; Object o = getDictionary(g, name); if ( o!=null ) return o; // not found, report unknown attr throw new STNoSuchAttributeException(name, scope); }