Consumer<? super SomeObject> action = obj -> { // some useful code here if(some_exceptional_condition_met) { throw new BreakException(); } }); try { someObjects.forEach(action); } catch (BreakException e) { // here you know that your condition has been met at least once }
/** * @return a new TagScript based on whether * the given Tag class is a bean tag or DynaTag */ public static TagScript newInstance(Class tagClass) { TagFactory factory = new DefaultTagFactory(tagClass); return new TagScript(factory); }
/** * Factory method to create a new Tag instance. * The default implementation is to delegate to the TagFactory */ protected Tag createTag() throws JellyException { if ( tagFactory != null) { return tagFactory.createTag(localName, getSaxAttributes()); } return null; }
@Override protected Tag createTag() throws JellyException { return new StaticTag(getNsUri(),getLocalName(),getElementName()); }
@Override public void addAttribute(String name, Expression expression) { allAttributesAreConstant &= expression instanceof ConstantExpression; super.addAttribute(name, expression); }
/** Creates a new script to execute the given tag name and attributes */ public TagScript createTagScript(final String name, final Attributes attributes) throws JellyException { return new TagScript( new TagFactory() { public Tag createTag(String name, Attributes attributes) throws JellyException { return DynamicTagLibrary.this.createTag(name, attributes); } } ); }
/** * Set the input stream * @param scriptAsInputStream */ public void setScript(InputStream scriptAsInputStream) { m_inputStream = scriptAsInputStream; compileScriptAndKeep(); }
/** * @return the bean that has just been created */ public Object getBean() { return getDynaBean(); } }
/** * Sets the name of the attribute */ public void setName(String name) { attribute.setName(name); }
/** * Sets the default value of this attribute */ public void setDefaultValue(Expression defaultValue) { attribute.setDefaultValue(defaultValue); } }
@Override protected Tag createTag() throws JellyException { return new StaticTag(getNsUri(),getLocalName(),getElementName()); }
/** * @return a new TagScript based on whether * the given Tag class is a bean tag or DynaTag */ public static TagScript newInstance(Class tagClass) { TagFactory factory = new DefaultTagFactory(tagClass); return new TagScript(factory); }
/** * Factory method to create a new Tag instance. * The default implementation is to delegate to the TagFactory */ protected Tag createTag() throws JellyException { if ( tagFactory != null) { return tagFactory.createTag(localName, getSaxAttributes()); } return null; }
try { someObjects.forEach(obj -> { // some useful code here if(some_exceptional_condition_met) { throw new BreakException(); } } } catch (BreakException e) { // here you know that your condition has been met at least once }
/** * Set the input stream * @param scriptAsInputStream */ public void setScript(InputStream scriptAsInputStream) { m_inputStream = scriptAsInputStream; compileScriptAndKeep(); }
@Override protected Tag createTag() throws JellyException { return new StaticTag(getNsUri(),getLocalName(),getElementName()); }
/** * @return a new TagScript based on whether * the given Tag class is a bean tag or DynaTag */ public static TagScript newInstance(Class tagClass) { TagFactory factory = new DefaultTagFactory(tagClass); return new TagScript(factory); }
/** * Factory method to create a new Tag instance. * The default implementation is to delegate to the TagFactory */ protected Tag createTag() throws JellyException { if ( tagFactory != null) { return tagFactory.createTag(localName, getSaxAttributes()); } return null; }
/** * @return a new TagScript based on whether * the given Tag class is a bean tag or DynaTag */ public static TagScript newInstance(Class tagClass) { TagFactory factory = new DefaultTagFactory(tagClass); return new TagScript(factory); }
/** * Factory method to create a new Tag instance. * The default implementation is to delegate to the TagFactory */ protected Tag createTag() throws JellyException { if ( tagFactory != null) { return tagFactory.createTag(localName, getSaxAttributes()); } return null; }