I am writing a project on Google App Engine, within that I have many abstract classes which I hope I To be able to use in my future projects, and the many concrete classes they get from them, in other abstract classes, I have an abstract sarlet that the user manages, and I have an abstract user storing in the datastore near AbstractUser and by stating Individual users are registered with me, whether or not all the required fields and methods. This does not apply to any specific specific functionality. Intangible Saarlet which manages users, refers only to the methods declared in the abbutuus class, to access it, log out and register (for unregistered users) Allows to generate links. To implement project-specific user functionality, I need the sub-section of the abstract user. Servlets used in my project are all indirect descents of intangible user management servlet, and user has a protected field in it, so the descendants can use the servlet as its area. However, whenever I want to use any specific specific method of concrete user, I have to put it in that type of form. I.e.
(abstract user management servlet) ... AbstractUser user = getUser (); ... Abstract Protected AbstractUser getUser (); (Project-specific abstract servlet) @ Override protected abbatus user guest user () {MyUserFactory.getUser (); }
No other project specific servicelet:
int a = ((concrete user) user) .getA (); Well, what I want to do in some way depends on some of the project-specific essence class to create "user" in a super-class. Is this possible? And I do not want to move all user-management content into a project-specific layer, because I've already written it for my future projects :)
Your Thanks for the help.
your acronyms
generic:
Public Squared SarreRervlet & lt; T Abstraße user & gt; {Private T user; Protected abstract T getUser (); ...
Then you can implement AbstractUser
:
to use a specific sub-class ; Public Square ConcreteServlet ObjectServlet and LT; ConcreteUser & gt; {...
Then you will not need to cast, as you have T in base class, your implementation is now concrete user
:
@ override protected summary converter user () {..}
Comments
Post a Comment