Robert Burrell Donkin wrote:

> "RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" wrote:
>
> > Hello Everyone:
> >
> > Does anybody know of a method or technique
> > to determine if a ElementContainer or any other
> > ECS Element is empty, i.e., it contains no Elements?
>
> this isn't very pretty code but it works for me
>
> public boolean isEmpty(org.apache.ecs.ConcreteElement element)
> {
>     return !(element.keys().hasMoreElements();
> }
>
> i believe that it should be possible to add a better isEmpty() method to the
> ConcreteElement
> and maybe that'd be a bit better.
> don't know what other people think.
>

You could add something like that into the base class or do :

if(this.keys() == null) { ... }  // element is empty

Pretty sure that will work.   On another note I'm all for the idea of adding
the concept of attributetemplates into ecs so that people can easily create
templating libraries.  Would work something like:

AttributeTemplate at = new AttributeTemplate();
at.add(new Attribute(name,value));

SomeElement se = new SomeElement(at);
FooElement fe = new FooElement(at);

That way you can reuse an attribute set across many different elements therby
skipping the painful setFoo methods on every element you wish to create with
identical attributes.  Any comments?

-stephan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to