Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] JPA Definitions

Hey, Brian,

subclassing of singletons already looks like a pattern problem.
That is why I prefer delegation and think that all protected methods of the class which will never be subclassed should be changed to private.

Thanks,
Dmitry
Geraskov

22/03/2011 22:49, Brian Vosburgh wrote:
Hello, Dmitry.

I lean towards making the static field(s) private and having you delegate to the
singleton to get the annotation names, via getSupportingAnnotationNames().
(I'm not sure why the static fields are protected - copy/paste oversight?) I'm
not a big fan of subclassing singleton classes; but I'm not dogmatic about it.
What is better for you about subclassing vs. delegation?

Brian


On 3/22/2011 10:17 AM, Dmitry Geraskov wrote:
Hey, guys,

I am working on updating Hibernate tools plugins to new Dali API.
There are some annotations which I would like to add support for. The supporting annotations names are added by specifying "definitions".
Lets look at JavaEntityDefinition.
It is a singleton which provides Iterable<String> of supporting annotation. The annotation names are stored in
*protected* static final String[] field.
As the JavaEntityDefinition has *private* constructor I can't reuse the annotaions array and it seems like a design problem.
I guess I should use the JavaEntityDefinitioninstance instance as a delegate if I want to extend the list, right?
But it seems to me that JavaEntityDefinition should have protected constructor or public SUPPORTING_ANNOTATION_NAMES_ARRAY field.

Dmitry Geraskov.
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev
_______________________________________________ dali-dev mailing list dali-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dali-dev

Back to the top