I am trying to create a method that can accept different types of objects on which the object was passed Has been done, and then print it. Sometimes it will be an integer, sometimes a long, sometimes a string, sometimes a custom object, etc. Only one should be told that its string () is the method.
The current methodology was:
/ ** * Log in a message at the test level * @ Param Message: Log * Messages / Unfamiliar Test (String Message) {Log (level.Test, Message); }
I am still in an effort to increase it:
/ ** * Log in a message at the test level * @Param Message: One Object of any class applied to string * / Public Zero Test (Class; l & gt; & Gt; Message) {string messagestring = message.toString (); Logs (level test, message string); }
This syntax seems correct, but this does not give me what I want:
The method can not be tested (int) / Code> Is there a solid way to get this functionality in Java?
public zero test {log (level.txt, message.storing ( )); }
Autobocking will take care of priorities however proper warning: The default output of many (most?) Methods toString () is not very legible, because those objects Two String () method is postponed.
Comments
Post a Comment