barx Well-Known Member Licensed User Longtime User Apr 6, 2012 #1 Good day to all. Just wondering if using 'extends' can inherit documentation. Example: Super Class Code: class SuperClass{ /** *Does something really useful with the passed string of text *Example: *wow = UsefulMethod("example text") */ public void UsefulMethod(String text){ //Do some cool stuff } } Sub Class Code: class SubClass extends SuperClass{ } Doing this allows the UsefulMethod method to become available to use through the subclass BUT, the instructions are lost. Only way I have managed to do it is to copy the Documentation into the sub class. I guess this is kinda creating a pseudo method? example Code: class SubClass extends SuperClass{ /** *Does something really useful with the passed string of text *Example: *wow = UsefulMethod("example text") */ public void UsefulMethod(String text){ super.UsefulMethod(text) } } Is this the way to do it or is there a simple way? Thanks
Good day to all. Just wondering if using 'extends' can inherit documentation. Example: Super Class Code: class SuperClass{ /** *Does something really useful with the passed string of text *Example: *wow = UsefulMethod("example text") */ public void UsefulMethod(String text){ //Do some cool stuff } } Sub Class Code: class SubClass extends SuperClass{ } Doing this allows the UsefulMethod method to become available to use through the subclass BUT, the instructions are lost. Only way I have managed to do it is to copy the Documentation into the sub class. I guess this is kinda creating a pseudo method? example Code: class SubClass extends SuperClass{ /** *Does something really useful with the passed string of text *Example: *wow = UsefulMethod("example text") */ public void UsefulMethod(String text){ super.UsefulMethod(text) } } Is this the way to do it or is there a simple way? Thanks
Erel B4X founder Staff member Licensed User Longtime User Apr 6, 2012 #2 Documentation is inherited when you are referencing the source code of the super class.
barx Well-Known Member Licensed User Longtime User Apr 6, 2012 #3 Maybe I'm doing something wrong then as I currently doesn't show. I'll go over it again. Thanks. Sent from my HTC Vision using Tapatalk
Maybe I'm doing something wrong then as I currently doesn't show. I'll go over it again. Thanks. Sent from my HTC Vision using Tapatalk
barx Well-Known Member Licensed User Longtime User May 21, 2012 #4 Just to re-light this old flame as I now could do with this working to help out Kevin in this thread. I'm trying to extend the NotificationWrapper to add the required functionality. I write Code: Public Class AdvancedNotification extends NotificationWrapper{ ....New functions .... } When I add the library and try to use it the Tool Tips from the methods found in the original object are not present. Is it possible to Bring these forward. Also, is it possible to access the private subs in the super class. i.e. initiate Code: setValue(false, 2); from new library? Would I just be better copying the code of the original NotificationWrapper. Thank you...
Just to re-light this old flame as I now could do with this working to help out Kevin in this thread. I'm trying to extend the NotificationWrapper to add the required functionality. I write Code: Public Class AdvancedNotification extends NotificationWrapper{ ....New functions .... } When I add the library and try to use it the Tool Tips from the methods found in the original object are not present. Is it possible to Bring these forward. Also, is it possible to access the private subs in the super class. i.e. initiate Code: setValue(false, 2); from new library? Would I just be better copying the code of the original NotificationWrapper. Thank you...
Erel B4X founder Staff member Licensed User Longtime User May 22, 2012 #5 Documentation is only inherited when you reference the source code (with the comments) of the base class.
Documentation is only inherited when you reference the source code (with the comments) of the base class.
barx Well-Known Member Licensed User Longtime User May 22, 2012 #6 I wish I understood what you just said lol. Could give a quick example? E.g. how would inherit the 'initialize' documentation. Is it a matter of creating a method of initialize and it just calling super.initialize? Thanks again. Sent from my HTC Desire Z
I wish I understood what you just said lol. Could give a quick example? E.g. how would inherit the 'initialize' documentation. Is it a matter of creating a method of initialize and it just calling super.initialize? Thanks again. Sent from my HTC Desire Z
thedesolatesoul Expert Licensed User Longtime User May 22, 2012 #7 He means (I think) that if you added the classes as '.java' source files, then documentation will be inherited. If the classes are in '.jar' files, then it will not be inherited.
He means (I think) that if you added the classes as '.java' source files, then documentation will be inherited. If the classes are in '.jar' files, then it will not be inherited.
barx Well-Known Member Licensed User Longtime User May 22, 2012 #8 Ah yes. Think you may be right. N00bs eh? We're hard work. Well I obviously don't have the source so will have to re-type them out. Not a massive issue. Cheers Sent from my HTC Desire Z
Ah yes. Think you may be right. N00bs eh? We're hard work. Well I obviously don't have the source so will have to re-type them out. Not a massive issue. Cheers Sent from my HTC Desire Z