/** * Returns the instance of this class stored in the specified Jelly context. * If no such instance can be found, <b>null</b> is returned. * * @param ctx the Jelly context * @return the instance of this class stored in this context */ public static ComponentBuilderData get(JellyContext ctx) { return (ctx != null) ? (ComponentBuilderData) ctx .findVariable(CTX_NAME) : null; }
/** * Returns the instance of this class stored in the specified Jelly context. * If no instance can be found, <b>null</b> will be returned. * * @param context the Jelly context * @return the instance found in this context */ public static ActionBuilder get(JellyContext context) { return (context != null) ? (ActionBuilder) context .findVariable(CTX_KEY) : null; } }
/** * Returns the instance of this class stored in the specified Jelly context. * If no instance can be found, <b>null</b> will be returned. * * @param context the Jelly context * @return the instance found in this context */ public static WindowBuilderData get(JellyContext context) { return (context != null) ? (WindowBuilderData) context .findVariable(CTX_KEY) : null; }
/** * Finds the variable value of the given name in this context or in any other parent context. * If this context does not contain the variable, then its parent is used and then its parent * and so forth until the context with no parent is found. * * @return the value of the variable in this or one of its descendant contexts or null * if the variable could not be found. */ public Object findVariable(String name) { Object answer = variables.get(name); boolean definedHere = answer != null || variables.containsKey(name); if (definedHere) return answer; if ( answer == null && parent != null ) { answer = parent.findVariable(name); } // ### this is a hack - remove this when we have support for pluggable Scopes if ( answer == null ) { answer = getSystemProperty(name); } if (log.isDebugEnabled()) { log.debug("findVariable: " + name + " value: " + answer ); } return answer; }
/** * Finds the variable value of the given name in this context or in any other parent context. * If this context does not contain the variable, then its parent is used and then its parent * and so forth until the context with no parent is found. * * @return the value of the variable in this or one of its descendant contexts or null * if the variable could not be found. */ public Object findVariable(String name) { Object answer = variables.get(name); boolean definedHere = answer != null || variables.containsKey(name); if (definedHere) return answer; if ( answer == null && parent != null ) { answer = parent.findVariable(name); } // ### this is a hack - remove this when we have support for pluggable Scopes if ( answer == null ) { answer = getSystemProperty(name); } if (log.isDebugEnabled()) { log.debug("findVariable: " + name + " value: " + answer ); } return answer; }
/** * Finds the variable value of the given name in this context or in any other parent context. * If this context does not contain the variable, then its parent is used and then its parent * and so forth until the context with no parent is found. * * @return the value of the variable in this or one of its descendant contexts or null * if the variable could not be found. */ public Object findVariable(String name) { Object answer = variables.get(name); boolean definedHere = answer != null || variables.containsKey(name); if (definedHere) return answer; if ( answer == null && parent != null ) { answer = parent.findVariable(name); } // ### this is a hack - remove this when we have support for pluggable Scopes if ( answer == null ) { answer = getSystemProperty(name); } if (log.isDebugEnabled()) { log.debug("findVariable: " + name + " value: " + answer ); } return answer; }
/** * Finds the variable value of the given name in this context or in any other parent context. * If this context does not contain the variable, then its parent is used and then its parent * and so forth until the context with no parent is found. * * @return the value of the variable in this or one of its descendant contexts or null * if the variable could not be found. */ public Object findVariable(String name) { Object answer = variables.get(name); boolean definedHere = answer != null || variables.containsKey(name); if (definedHere) return answer; if ( answer == null && parent != null ) { answer = parent.findVariable(name); } // ### this is a hack - remove this when we have support for pluggable Scopes if ( answer == null ) { answer = getSystemProperty(name); } if (log.isDebugEnabled()) { log.debug("findVariable: " + name + " value: " + answer ); } return answer; }
/** * @return the goal manager instance */ protected WerkzProject getProject() { WerkzProject answer = null; ProjectTag tag = (ProjectTag) findAncestorWithClass( ProjectTag.class ); if ( tag != null ) { answer = tag.getProject(); } if ( answer == null ) { answer = (WerkzProject) context.findVariable( "org.apache.commons.jelly.werkz.Project" ); } return answer; }
/** * Returns a <code>BeanProvider</code> for accessing the bean with the * given name. This implementation checks whether the Jelly context contains * a variable with the given name. If this is the case, a bean provider * serving this value is returned. Otherwise the result of this method is * <b>null</b>. * * @param name the name of the desired bean * @return a <code>BeanProvider</code> for this bean */ public BeanProvider getBeanProvider(String name) { Object var = getContext().findVariable(name); return (var != null) ? ConstantBeanProvider.getInstance(var) : null; }
/** * @return the project instance */ public WerkzProject getProject() { if ( ( project == null ) && ( context != null ) ) { // we may be invoked inside a child script, so lets try find the parent project project = (WerkzProject) context.findVariable( "org.apache.commons.jelly.werkz.Project" ); if ( project == null ) { project = new WerkzProject(); context.setVariable( "org.apache.commons.jelly.werkz.Project", project ); } } return project; }
/** * Tries to obtain the menu bar with the given name. This implementation * searches the Jelly context for a variable with this name. * * @param name the name of the menu bar * @return the menu bar as an object * @throws WindowBuilderException if the window cannot be obtained */ protected Object fetchMenuBar(String name) throws WindowBuilderException { Object bar = getContext().findVariable(name); if (bar == null) { throw new WindowBuilderException("Cannot find menu bar with name " + name); } return bar; }
try { JellyContext jelly = Functions.getCurrentJellyContext(); Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext();
try { JellyContext jelly = Functions.getCurrentJellyContext(); Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext();
try { JellyContext jelly = Functions.getCurrentJellyContext(); Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext();
try { JellyContext jelly = Functions.getCurrentJellyContext(); Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext();
Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext();
Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext();
/** Retrieve a variable. * * @param name The name of the variable. * * @return The value of the variable, if set, otherwise * <code>null</code>. */ public Object getVariable( String name ) { Object value; // We need to avoid calling getVariable() on a parent context so // that expressions are evaluated lazily if ( isInherit() ) { value = super.findVariable( name ); } else { value = super.getVariable( name ); } if ( value instanceof Expression ) { // TODO: need to handle instances of infinitely recursion when an expression contains itself Expression expression = (Expression) value; value = expression.evaluate( this ); } return value; }
Object obj = getContext().findVariable(getRef()); if (obj == null)
/** * Obtains the bean for this tag. This method is called when one of the * reference attributes is set. * * @return the referenced bean (can be <b>null</b>, then an exception will * be thrown in later processing */ protected Object fetchBean() { if (isAttributeDefined(ATTR_REF)) { return getContext().findVariable(getStringAttr(ATTR_REF)); } else { BeanContext bc = FormBaseTag.getBuilderData(getContext()) .getBeanContext(); if (isAttributeDefined(ATTR_BEAN_CLASS)) { Class<?> beanClass = FormBaseTag.convertToClass(getAttributes() .get(ATTR_BEAN_CLASS)); return bc.getBean(beanClass); } else { return bc.getBean(getStringAttr(ATTR_BEAN_NAME)); } } }