I am reverse engineering some Java code into a class diagram. Now I'm wondering how to model classes that are from a library that I didn't design. If I'm writing them down as classes, I should maybe also know what interfaces they implement, etc, and put that in the diagram. How far do I go with this? Is it better to write them down as attributes of my own classes?
Include whatever classes and interfaces your code uses in the diagram for your code.
Place the elements from the library into a package which represents the library's package.
Use whatever level of detail is sufficient for what the diagram represents.
If you only want to record that your code uses the library, a «uses» relationship to the package representing the library
If you have associations to elements in the library, model the elements you relate to but no detail in them.
If you or extend or implement classes or interfaces, model the attributes and operations of those elements.
If your code relies on a sequence of operations on elements in the library, you may model the operations, or may just use messages which are not directly linked to them, depending what your tool allows.
I found an interesting link which could help: http://www.ejb3.org/jar_file_reverse/jar_file_reverse.html
You can reverse your java project to show .java classes and then just drag and drop .class classes coming from the jar to your diagram. You can make a differentiation between them by adding the package name in the class name, or by changing the color of the class etc....