[Yanel-dev] exists() method for Node interface

Michael Wechner michael.wechner at wyona.com
Tue Feb 13 15:22:56 CET 2007


Josias Thöny wrote:

> Michael Wechner wrote:
>
>> Hi
>>
>> It seems to me that we should add an "exists" method to 
>> /org/wyona/yarep/core/Node.java
>>
>> WDYT?
>
>
> No, because the Repository already has a method existsNode(path).


I guess this what I was looking for

> If you have an instance of class Node, it means that it exists. You 
> should not be able to get an instance of a node which does not exist.


well, getNode(path).isCollection() will throw a NullPointerException 
when the node does not exist, hence I would like to test it first.
Of course one could do something like

getNode(path) !=  null && getNode(path).isCollection()

but I think

existsNode(path) && getNode(path).isCollection()

is nicer ;-)

Thanks

Michi

>
> hth,
> Josias
>
>>
>> Cheers
>>
>> Michi
>>
>
>
> _______________________________________________
> Yanel-development mailing list
> Yanel-development at wyona.com
> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner at wyona.com                        michi at apache.org
+41 44 272 91 61




More information about the Yanel-development mailing list