Angela Schreiber wrote:

on the other hand there is are a couple of methods, that
are just there for improving code readability ('getDavName'),
others that i think contain really internal stuff such
as 'isLocked', 'isFilteredItem' or 'isJsrLockable'.

let's say i'm implementing a dav extension that defines a new http method. my new method is sort of like DavResource.addMember but not quite the same, and i can't cleanly override or otherwise reuse DavResourceImpl.addMember, so i have to add a method that looks a lot like it. suddenly i need access to isLocked, potentially isFilteredItem, etc.

this is exactly what happened when i needed to implement MKCALENDAR for caldav. of course, with the latest revision of jcr-server, the import/export facility meets my needs and i don't need a specialized method resource method anymore. but what's to say some sort of situation like this couldn't happen again?

this is the point about private methods from my point of
view. since it's an opensource project, i will
not know (and i should not know) about subclasses. but
i must pay attention and respect potential subclasses,
if a mark a method protected.

well yeah. there is a happy medium. for a method where you don't have a strong reason to keep it private, make it protected and let subclassers decide whether or not they will use it.

just one more example: the 'setIsCollection' method in the DavResourceImpl. this one is a hack from my point of view.
since i wanted to complete my modifications i left it...
but i don't like it a all and i would not want this to
be protected.

it's totally a hack, but one that is required since we're using the same class to model resources that already exist in the repository as well as ones that are being created in the current request. you'll see i had to do the same thing in CosmoDavResourceImpl, with a setIsCalendarCollection.

i have briefly considered making a new implementation of DavResource for resources which are in the process of being created, but i haven't looked at specifically how to do it yet.

Reply via email to