--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>javainspect</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
--- /dev/null
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=false
+version=1
--- /dev/null
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
--- /dev/null
+digraph Java {
+graph [rankdir=LR, overlap = false, concentrate=true];
+
+// Class: eu.svjatoslav.javainspect.structure.ClassDescriptor
+ class_eu_svjatoslav_javainspect_structure_ClassDescriptor[label=<<TABLE BORDER="4" CELLBORDER="1" CELLSPACING="0">
+
+ // class descriptor header
+ <TR><TD colspan="2" PORT="f0"><FONT POINT-SIZE="8.0" >eu.svjatoslav.javainspect.structure</FONT><br/><FONT POINT-SIZE="25.0"><B>ClassDescriptor</B></FONT></TD></TR>
+
+ // fields:
+ // methods
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="methods" ALIGN="left"><FONT POINT-SIZE="11.0">methods</FONT></TD></TR>
+ // distinctiveReferenceColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="distinctiveReferenceColor" ALIGN="left"><FONT POINT-SIZE="11.0">distinctiveReferenceColor</FONT></TD></TR>
+ // interfaceColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="interfaceColor" ALIGN="left"><FONT POINT-SIZE="11.0">interfaceColor</FONT></TD></TR>
+ // superClass
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">ClassDescriptor</FONT></td><TD PORT="superClass" ALIGN="left"><FONT POINT-SIZE="11.0">superClass</FONT></TD></TR>
+ // dump
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">Graph</FONT></td><TD PORT="dump" ALIGN="left"><FONT POINT-SIZE="11.0">dump</FONT></TD></TR>
+ // MAX_REFERECNES_COUNT
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">int</FONT></td><TD PORT="MAX_REFERECNES_COUNT" ALIGN="left"><FONT POINT-SIZE="11.0">MAX_REFERECNES_COUNT</FONT></TD></TR>
+ // nameToFieldMap
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">Map</FONT></td><TD PORT="nameToFieldMap" ALIGN="left"><FONT POINT-SIZE="11.0">nameToFieldMap</FONT></TD></TR>
+ // superClassColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="superClassColor" ALIGN="left"><FONT POINT-SIZE="11.0">superClassColor</FONT></TD></TR>
+ // isInterface
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isInterface" ALIGN="left"><FONT POINT-SIZE="11.0">isInterface</FONT></TD></TR>
+ // referenceCount
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">int</FONT></td><TD PORT="referenceCount" ALIGN="left"><FONT POINT-SIZE="11.0">referenceCount</FONT></TD></TR>
+ // isEnum
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isEnum" ALIGN="left"><FONT POINT-SIZE="11.0">isEnum</FONT></TD></TR>
+ // interfaces
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="interfaces" ALIGN="left"><FONT POINT-SIZE="11.0">interfaces</FONT></TD></TR>
+ // fullyQualifiedName
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="fullyQualifiedName" ALIGN="left"><FONT POINT-SIZE="11.0">fullyQualifiedName</FONT></TD></TR>
+ // isArray
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isArray" ALIGN="left"><FONT POINT-SIZE="11.0">isArray</FONT></TD></TR>
+
+ // methods:
+ // getClassName
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getClassName" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getClassName</FONT></TD></TR>
+ // getDot
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getDot" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getDot</FONT></TD></TR>
+ // isVisible
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isVisible" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">isVisible</FONT></TD></TR>
+ // indexFields
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="indexFields" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">indexFields</FONT></TD></TR>
+ // areReferencesShown
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="areReferencesShown" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">areReferencesShown</FONT></TD></TR>
+ // enlistFieldReferences
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="enlistFieldReferences" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">enlistFieldReferences</FONT></TD></TR>
+ // enlistFields
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="enlistFields" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">enlistFields</FONT></TD></TR>
+ // getEmbeddedDot
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getEmbeddedDot" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getEmbeddedDot</FONT></TD></TR>
+ // enlistImplementedInterfaces
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="enlistImplementedInterfaces" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">enlistImplementedInterfaces</FONT></TD></TR>
+ // getGraphId
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getGraphId" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getGraphId</FONT></TD></TR>
+ // enlistMethodReferences
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="enlistMethodReferences" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">enlistMethodReferences</FONT></TD></TR>
+ // enlistMethods
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="enlistMethods" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">enlistMethods</FONT></TD></TR>
+ // enlistSuperClass
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="enlistSuperClass" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">enlistSuperClass</FONT></TD></TR>
+ // generateDotHeader
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="generateDotHeader" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">generateDotHeader</FONT></TD></TR>
+ // getBackgroundColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getBackgroundColor" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getBackgroundColor</FONT></TD></TR>
+ // getBorderWidth
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getBorderWidth" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getBorderWidth</FONT></TD></TR>
+ // getPackageName
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getPackageName" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getPackageName</FONT></TD></TR>
+ // getAllFields
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="getAllFields" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getAllFields</FONT></TD></TR>
+ // getColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getColor" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getColor</FONT></TD></TR>
+ // getDistinctiveColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getDistinctiveColor" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getDistinctiveColor</FONT></TD></TR>
+ // setDistinctiveColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="setDistinctiveColor" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">setDistinctiveColor</FONT></TD></TR>
+ // registerReference
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="registerReference" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">registerReference</FONT></TD></TR>
+ </TABLE>>, shape="none"];
+
+ // field references to other classes
+ class_eu_svjatoslav_javainspect_structure_ClassDescriptor:methods -> class_eu_svjatoslav_javainspect_structure_MethodDescriptor[label="methods", color="antiquewhite4", style="bold"];
+ class_eu_svjatoslav_javainspect_structure_ClassDescriptor:dump -> class_eu_svjatoslav_javainspect_structure_Graph[label="dump", color="blueviolet", style="bold"];
+ class_eu_svjatoslav_javainspect_structure_ClassDescriptor:nameToFieldMap -> class_eu_svjatoslav_javainspect_structure_FieldDescriptor[label="nameToFieldMap", color="brown4", style="bold"];
+
+ // method references to other classes
+ class_eu_svjatoslav_javainspect_structure_ClassDescriptor:getAllFields -> class_eu_svjatoslav_javainspect_structure_FieldDescriptor[label="getAllFields", color="brown4", style="dotted, bold"];
+
+ // interfaces implemented by class: eu.svjatoslav.javainspect.structure.ClassDescriptor
+ class_eu_svjatoslav_javainspect_structure_GraphElement -> class_eu_svjatoslav_javainspect_structure_ClassDescriptor[style="dotted, tapered", color="olivedrab2", penwidth=20, dir="forward"];
+
+// Class: eu.svjatoslav.javainspect.structure.MethodDescriptor
+ class_eu_svjatoslav_javainspect_structure_MethodDescriptor[label=<<TABLE BORDER="1" CELLBORDER="1" CELLSPACING="0">
+
+ // class descriptor header
+ <TR><TD colspan="2" PORT="f0"><FONT POINT-SIZE="8.0" >eu.svjatoslav.javainspect.structure</FONT><br/><FONT POINT-SIZE="25.0"><B>MethodDescriptor</B></FONT></TD></TR>
+
+ // fields:
+ // name
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="name" ALIGN="left"><FONT POINT-SIZE="11.0">name</FONT></TD></TR>
+ // parent
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">ClassDescriptor</FONT></td><TD PORT="parent" ALIGN="left"><FONT POINT-SIZE="11.0">parent</FONT></TD></TR>
+ // typeArguments
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="typeArguments" ALIGN="left"><FONT POINT-SIZE="11.0">typeArguments</FONT></TD></TR>
+ // returnType
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">ClassDescriptor</FONT></td><TD PORT="returnType" ALIGN="left"><FONT POINT-SIZE="11.0">returnType</FONT></TD></TR>
+
+ // methods:
+ // getDot
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getDot" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getDot</FONT></TD></TR>
+ // isVisible
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isVisible" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">isVisible</FONT></TD></TR>
+ // getEmbeddedDot
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getEmbeddedDot" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getEmbeddedDot</FONT></TD></TR>
+ // getGraphId
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getGraphId" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getGraphId</FONT></TD></TR>
+ // getMethodLabel
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getMethodLabel" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getMethodLabel</FONT></TD></TR>
+ </TABLE>>, shape="none"];
+
+ // field references to other classes
+
+ // method references to other classes
+
+ // interfaces implemented by class: eu.svjatoslav.javainspect.structure.MethodDescriptor
+ class_eu_svjatoslav_javainspect_structure_GraphElement -> class_eu_svjatoslav_javainspect_structure_MethodDescriptor[style="dotted, tapered", color="olivedrab2", penwidth=20, dir="forward"];
+
+// Class: eu.svjatoslav.javainspect.structure.Graph
+ class_eu_svjatoslav_javainspect_structure_Graph[label=<<TABLE BORDER="1" CELLBORDER="1" CELLSPACING="0">
+
+ // class descriptor header
+ <TR><TD colspan="2" PORT="f0"><FONT POINT-SIZE="8.0" >eu.svjatoslav.javainspect.structure</FONT><br/><FONT POINT-SIZE="25.0"><B>Graph</B></FONT></TD></TR>
+
+ // fields:
+ // nameToClassMap
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">Map</FONT></td><TD PORT="nameToClassMap" ALIGN="left"><FONT POINT-SIZE="11.0">nameToClassMap</FONT></TD></TR>
+
+ // methods:
+ // addClass
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">ClassDescriptor</FONT></td><TD PORT="addClass" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">addClass</FONT></TD></TR>
+ // addObject
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">ClassDescriptor</FONT></td><TD PORT="addObject" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">addObject</FONT></TD></TR>
+ // generateGraph
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="generateGraph" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">generateGraph</FONT></TD></TR>
+ // generateGraph
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="generateGraph" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">generateGraph</FONT></TD></TR>
+ </TABLE>>, shape="none"];
+
+ // field references to other classes
+
+ // method references to other classes
+
+// Class: eu.svjatoslav.javainspect.structure.Utils
+ class_eu_svjatoslav_javainspect_structure_Utils[label=<<TABLE BORDER="1" CELLBORDER="1" CELLSPACING="0">
+
+ // class descriptor header
+ <TR><TD colspan="2" PORT="f0"><FONT POINT-SIZE="8.0" >eu.svjatoslav.javainspect.structure</FONT><br/><FONT POINT-SIZE="25.0"><B>Utils</B></FONT></TD></TR>
+
+ // fields:
+ // lightColors
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="lightColors" ALIGN="left"><FONT POINT-SIZE="11.0">lightColors</FONT></TD></TR>
+ // systemDataTypes
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="systemDataTypes" ALIGN="left"><FONT POINT-SIZE="11.0">systemDataTypes</FONT></TD></TR>
+ // lastChosenLightColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">int</FONT></td><TD PORT="lastChosenLightColor" ALIGN="left"><FONT POINT-SIZE="11.0">lastChosenLightColor</FONT></TD></TR>
+ // lastChosenDarkColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">int</FONT></td><TD PORT="lastChosenDarkColor" ALIGN="left"><FONT POINT-SIZE="11.0">lastChosenDarkColor</FONT></TD></TR>
+ // systemMethods
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="systemMethods" ALIGN="left"><FONT POINT-SIZE="11.0">systemMethods</FONT></TD></TR>
+ // enumMethods
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="enumMethods" ALIGN="left"><FONT POINT-SIZE="11.0">enumMethods</FONT></TD></TR>
+ // darkColors
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="darkColors" ALIGN="left"><FONT POINT-SIZE="11.0">darkColors</FONT></TD></TR>
+ // systemPackages
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="systemPackages" ALIGN="left"><FONT POINT-SIZE="11.0">systemPackages</FONT></TD></TR>
+
+ // methods:
+ // initDarkColors
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="initDarkColors" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">initDarkColors</FONT></TD></TR>
+ // initEnumMethods
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="initEnumMethods" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">initEnumMethods</FONT></TD></TR>
+ // initLightColors
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="initLightColors" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">initLightColors</FONT></TD></TR>
+ // initSystemDataTypes
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="initSystemDataTypes" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">initSystemDataTypes</FONT></TD></TR>
+ // initSystemMethods
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="initSystemMethods" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">initSystemMethods</FONT></TD></TR>
+ // initSystemPackages
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">void</FONT></td><TD PORT="initSystemPackages" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">initSystemPackages</FONT></TD></TR>
+ // isSystemMethod
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isSystemMethod" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">isSystemMethod</FONT></TD></TR>
+ // getNextDarkColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getNextDarkColor" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getNextDarkColor</FONT></TD></TR>
+ // getNextLightColor
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getNextLightColor" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getNextLightColor</FONT></TD></TR>
+ // isSystemDataType
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isSystemDataType" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">isSystemDataType</FONT></TD></TR>
+ // isSystemPackage
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isSystemPackage" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">isSystemPackage</FONT></TD></TR>
+ // isEnumMethod
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isEnumMethod" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">isEnumMethod</FONT></TD></TR>
+ </TABLE>>, shape="none"];
+
+ // field references to other classes
+
+ // method references to other classes
+
+// Class: eu.svjatoslav.javainspect.structure.GraphElement
+ class_eu_svjatoslav_javainspect_structure_GraphElement[label=<<TABLE bgcolor="darkslategray1" BORDER="1" CELLBORDER="1" CELLSPACING="0">
+
+ // class descriptor header
+ <TR><TD colspan="2" PORT="f0"><FONT POINT-SIZE="8.0" >eu.svjatoslav.javainspect.structure</FONT><br/><FONT POINT-SIZE="25.0"><B>GraphElement</B></FONT></TD></TR>
+
+ // methods:
+ // getDot
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getDot" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getDot</FONT></TD></TR>
+ // isVisible
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isVisible" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">isVisible</FONT></TD></TR>
+ // getEmbeddedDot
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getEmbeddedDot" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getEmbeddedDot</FONT></TD></TR>
+ // getGraphId
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getGraphId" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getGraphId</FONT></TD></TR>
+ </TABLE>>, shape="none"];
+
+ // method references to other classes
+
+// Class: eu.svjatoslav.javainspect.structure.FieldDescriptor
+ class_eu_svjatoslav_javainspect_structure_FieldDescriptor[label=<<TABLE BORDER="1" CELLBORDER="1" CELLSPACING="0">
+
+ // class descriptor header
+ <TR><TD colspan="2" PORT="f0"><FONT POINT-SIZE="8.0" >eu.svjatoslav.javainspect.structure</FONT><br/><FONT POINT-SIZE="25.0"><B>FieldDescriptor</B></FONT></TD></TR>
+
+ // fields:
+ // name
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="name" ALIGN="left"><FONT POINT-SIZE="11.0">name</FONT></TD></TR>
+ // parent
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">ClassDescriptor</FONT></td><TD PORT="parent" ALIGN="left"><FONT POINT-SIZE="11.0">parent</FONT></TD></TR>
+ // typeArguments
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">List</FONT></td><TD PORT="typeArguments" ALIGN="left"><FONT POINT-SIZE="11.0">typeArguments</FONT></TD></TR>
+ // type
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">ClassDescriptor</FONT></td><TD PORT="type" ALIGN="left"><FONT POINT-SIZE="11.0">type</FONT></TD></TR>
+
+ // methods:
+ // getDot
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getDot" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getDot</FONT></TD></TR>
+ // isVisible
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">boolean</FONT></td><TD PORT="isVisible" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">isVisible</FONT></TD></TR>
+ // getEmbeddedDot
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getEmbeddedDot" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getEmbeddedDot</FONT></TD></TR>
+ // getGraphId
+ <TR><td ALIGN="right"><FONT POINT-SIZE="8.0">String</FONT></td><TD PORT="getGraphId" ALIGN="left"><FONT COLOR ="red" POINT-SIZE="11.0">getGraphId</FONT></TD></TR>
+ </TABLE>>, shape="none"];
+
+ // field references to other classes
+
+ // method references to other classes
+
+ // interfaces implemented by class: eu.svjatoslav.javainspect.structure.FieldDescriptor
+ class_eu_svjatoslav_javainspect_structure_GraphElement -> class_eu_svjatoslav_javainspect_structure_FieldDescriptor[style="dotted, tapered", color="olivedrab2", penwidth=20, dir="forward"];
+}
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
+<html>\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r
+<title>JavaInspect</title>\r
+</head>\r
+<body>\r
+ <h1>JavaInspect - Utility to visualize java software</h1>\r
+ <a\r
+ href="http://www2.svjatoslav.eu/gitweb/?p=javainspect.git;a=snapshot;h=HEAD;sf=tgz">Download</a>\r
+ \r
+ <a\r
+ href="http://www2.svjatoslav.eu/gitbrowse/javainspect/doc/index.html">Online\r
+ homepage</a> \r
+ <a href="http://svjatoslav.eu/programs.jsp">Other applications\r
+ hosted on svjatoslav.eu</a>\r
+ <pre>\r
+<b>Program author:</b>\r
+ Svjatoslav Agejenko\r
+ Homepage: <a href="http://svjatoslav.eu">http://svjatoslav.eu</a>\r
+ Email: <a href="mailto:svjatoslav@svjatoslav.eu">svjatoslav@svjatoslav.eu</a>\r
+\r
+This software is distributed under <a\r
+ href="http://www.gnu.org/licenses/gpl-2.0.html">GNU GENERAL PUBLIC LICENSE Version 2</a>.\r
+\r
+</pre>\r
+\r
+ <h2>General</h2>\r
+\r
+ JavaInspect is a Java library that you can embed into your Java project\r
+ with a few lines of Maven configuration and then visualize any part of\r
+ your Java program structure with few simple JavaInspect API calls at\r
+ application runtime.\r
+\r
+ <br />\r
+ <br /> JavaInspect uses Java reflection to discover class relations and\r
+ structure and produces GraphViz dot file that describes your\r
+ application. Then launches GraphViz to generate bitmap graph in PNG\r
+ format on your Desktop directory.\r
+\r
+\r
+ <h2>Current status</h2>\r
+\r
+ This is simple utility, quickly written. Tested on Linux (can be\r
+ relatively simply ported to other operating systems too). So far I used\r
+ it for my own needs. There might be bugs and missing features. Feedback\r
+ and code contributions are welcome.\r
+\r
+\r
+ <h2>Example graphs</h2>\r
+\r
+ Example visualization of\r
+ <a href="http://www2.svjatoslav.eu/gitbrowse/sixth/doc/">Sixth</a>\r
+ project:\r
+ <a\r
+ href="http://www2.svjatoslav.eu/gitbrowse/sixth/doc/architecture%20graphs/index.html">architecture\r
+ graphs</a>\r
+\r
+ <br />\r
+ <br /> A very simple example:\r
+ <br />\r
+ <a href="example.png"><img src="example.resized.png" /></a>\r
+\r
+ <br /> Graph legend:\r
+ <br />\r
+ <img src="legend.png" />\r
+\r
+\r
+ <h2>Usage example</h2>\r
+\r
+ Following example produces graph for JavaInspect itself:\r
+\r
+ <pre>\r
+<code>\r
+// Create graph\r
+final Graph graph = new Graph();\r
+\r
+// Add some object to the graph.\r
+graph.addObject(graph);\r
+\r
+// Add some class to the graph.\r
+graph.addClass(Utils.class);\r
+\r
+// Produce bitmap image titled "JavaInspect.png" to the user Desktop\r
+// directory.\r
+graph.generateGraph("JavaInspect", true);\r
+</code>\r
+\r
+\r
+Result:\r
+ Generated DOT file: <a href="JavaInspect.dot">JavaInspect.dot</a>\r
+ Generated PNG image: <a href="JavaInspect.png">JavaInspect.png</a>\r
+\r
+</pre>\r
+\r
+\r
+\r
+ <h2>Embedding JavaInspect in your project</h2>\r
+ <pre>\r
+\r
+Declare JavaInspect as dependency:\r
+\r
+ <dependencies>\r
+\r
+ ...\r
+\r
+ <dependency>\r
+ <groupId>eu.svjatoslav</groupId>\r
+ <artifactId>javainspect</artifactId>\r
+ <version>1.0-SNAPSHOT</version>\r
+ </dependency>\r
+ \r
+ </dependencies>\r
+ \r
+ \r
+ \r
+Add Maven repository to retrieve artifact from:\r
+ \r
+ <repositories>\r
+ <repository>\r
+ <id>svjatoslav.eu</id>\r
+ <name>Svjatoslav repository</name>\r
+ <url>http://www2.svjatoslav.eu/maven/</url>\r
+ </repository>\r
+ </repositories>\r
+</pre>\r
+\r
+\r
+\r
+\r
+ <h2>Requirements</h2>\r
+\r
+ <br>\r
+ <a href="http://www.graphviz.org/">GraphViz</a> - shall be installed on\r
+ the computer.\r
+\r
+\r
+</body>\r
+</html>\r
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>eu.svjatoslav</groupId>
+ <artifactId>javainspect</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Java inspect</name>
+ <description>Java inspect</description>
+
+ <organization>
+ <name>svjatoslav.eu</name>
+ <url>http://svjatoslav.eu</url>
+ </organization>
+
+ <dependencies>
+ <dependency>
+ <groupId>eu.svjatoslav</groupId>
+ <artifactId>svjatoslavcommons</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <optimize>true</optimize>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-ssh</artifactId>
+ <version>2.2</version>
+ </extension>
+ </extensions>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>svjatoslav.eu</id>
+ <name>Svjatoslav repository</name>
+ <url>http://www2.svjatoslav.eu/maven/</url>
+ </repository>
+ </repositories>
+
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>svjatoslav.eu</id>
+ <name>svjatoslav.eu</name>
+ <url>scp://svjatoslav.eu:7022/var/www/maven</url>
+ </snapshotRepository>
+ <repository>
+ <id>svjatoslav.eu</id>
+ <name>svjatoslav.eu</name>
+ <url>scp://svjatoslav.eu:7022/var/www/maven</url>
+ </repository>
+ </distributionManagement>
+
+ <scm>
+ <connection>scm:git:ssh://git@svjatoslav.eu:7022/home/git/repositories/javainspect.git</connection>
+ <developerConnection>scm:git:ssh://git@svjatoslav.eu:7022/home/git/repositories/javainspect.git</developerConnection>
+ </scm>
+
+</project>
\ No newline at end of file
--- /dev/null
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.javainspect.example;
+
+import eu.svjatoslav.javainspect.example.structure.SampleClass;
+import eu.svjatoslav.javainspect.structure.Graph;
+
+public class RenderExampleProject {
+
+ public static void main(final String[] args) {
+ final Graph graph = new Graph();
+
+ graph.addClass(SampleClass.class);
+
+ graph.generateGraph("example");
+
+ }
+
+}
--- /dev/null
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.javainspect.example;
+
+import java.io.FileNotFoundException;
+
+import eu.svjatoslav.javainspect.structure.Graph;
+import eu.svjatoslav.javainspect.structure.Utils;
+
+public class RenderJavaInspect {
+
+ public static void main(final String[] args) throws FileNotFoundException {
+
+ // Create graph
+ final Graph graph = new Graph();
+
+ // Add some object to the graph.
+ graph.addObject(graph);
+
+ // Add some class to the graph.
+ graph.addClass(Utils.class);
+
+ // Produce bitmap image titled "JavaInspect.png" to the user Desktop
+ // directory.
+ graph.generateGraph("JavaInspect", true);
+ }
+}
--- /dev/null
+package eu.svjatoslav.javainspect.example.structure;
+
+public class ObjectReturnedByMethod {
+
+}
--- /dev/null
+package eu.svjatoslav.javainspect.example.structure;
+
+public class ObjectVisibleAsClassField {
+
+}
--- /dev/null
+package eu.svjatoslav.javainspect.example.structure;
+
+public class SampleClass extends SampleSuperClass {
+
+ ObjectVisibleAsClassField sampleClassField;
+
+ public ObjectReturnedByMethod sampleMethod() {
+ return new ObjectReturnedByMethod();
+ }
+
+}
--- /dev/null
+package eu.svjatoslav.javainspect.example.structure;
+
+public enum SampleEnum {
+
+ ONE, TWO, THREE, FOUR
+
+}
--- /dev/null
+package eu.svjatoslav.javainspect.example.structure;
+
+public interface SampleInterface {
+ public SampleEnum getSomeValue();
+}
--- /dev/null
+package eu.svjatoslav.javainspect.example.structure;
+
+public class SampleSuperClass implements SampleInterface {
+
+ @Override
+ public SampleEnum getSomeValue() {
+ return SampleEnum.ONE;
+ }
+
+}
--- /dev/null
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.javainspect.structure;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Describes single class instance
+ */
+public class ClassDescriptor implements GraphElement {
+
+ private static final int MAX_REFERECNES_COUNT = 10;
+
+ public final String fullyQualifiedName;
+
+ Map<String, FieldDescriptor> nameToFieldMap = new HashMap<String, FieldDescriptor>();
+
+ public List<MethodDescriptor> methods = new ArrayList<MethodDescriptor>();
+
+ /**
+ * Incoming arrows will have this color.
+ */
+ private String distinctiveReferenceColor;
+
+ private String interfaceColor;
+
+ private String superClassColor;
+
+ boolean isEnum;
+
+ boolean isInterface;
+
+ boolean isArray;
+
+ private final Graph dump;
+
+ List<ClassDescriptor> interfaces = new ArrayList<ClassDescriptor>();
+
+ ClassDescriptor superClass;
+
+ /**
+ * Amount of field and method references pointing to this class.
+ */
+ private int referenceCount = 0;
+
+ public ClassDescriptor(final Class<? extends Object> clazz, final Graph dump) {
+ this.dump = dump;
+
+ fullyQualifiedName = clazz.getName();
+ dump.nameToClassMap.put(fullyQualifiedName, this);
+
+ isArray = clazz.isArray();
+
+ if (isArray) {
+ final Class<?> componentType = clazz.getComponentType();
+ dump.addClass(componentType);
+ }
+
+ // System.out.println("class: " + fullyQualifiedName);
+
+ isEnum = clazz.isEnum();
+
+ isInterface = clazz.isInterface();
+
+ if (!isVisible())
+ return;
+
+ indexFields(clazz.getDeclaredFields());
+ indexFields(clazz.getFields());
+
+ indexMethods(clazz);
+
+ for (final Class interfaceClass : clazz.getInterfaces())
+ interfaces.add(dump.addClass(interfaceClass));
+
+ superClass = dump.addClass(clazz.getSuperclass());
+ }
+
+ public boolean areReferencesShown() {
+ return referenceCount <= MAX_REFERECNES_COUNT;
+ }
+
+ public void enlistFieldReferences(final StringBuffer result) {
+ if (nameToFieldMap.isEmpty())
+ return;
+
+ result.append("\n");
+ result.append(" // field references to other classes\n");
+ for (final Map.Entry<String, FieldDescriptor> entry : nameToFieldMap
+ .entrySet())
+ result.append(entry.getValue().getDot());
+ }
+
+ public void enlistFields(final StringBuffer result) {
+ if (nameToFieldMap.isEmpty())
+ return;
+
+ result.append("\n");
+ result.append(" // fields:\n");
+
+ // enlist fields
+ for (final Map.Entry<String, FieldDescriptor> entry : nameToFieldMap
+ .entrySet())
+ result.append(entry.getValue().getEmbeddedDot());
+ }
+
+ public void enlistImplementedInterfaces(final StringBuffer result) {
+ if (interfaces.isEmpty())
+ return;
+
+ result.append("\n");
+ result.append(" // interfaces implemented by class: "
+ + fullyQualifiedName + "\n");
+
+ for (final ClassDescriptor interfaceDescriptor : interfaces) {
+ if (!interfaceDescriptor.isVisible())
+ continue;
+
+ result.append(" " + interfaceDescriptor.getGraphId() + " -> "
+ + getGraphId() + "[style=\"dotted, tapered\", color=\""
+ + interfaceDescriptor.getInterfaceColor()
+ + "\", penwidth=20, dir=\"forward\"];\n");
+ }
+ }
+
+ public void enlistMethodReferences(final StringBuffer result) {
+ if (methods.isEmpty())
+ return;
+
+ result.append("\n");
+ result.append(" // method references to other classes\n");
+ for (final MethodDescriptor methodDescriptor : methods)
+ result.append(methodDescriptor.getDot());
+ }
+
+ public void enlistMethods(final StringBuffer result) {
+ if (methods.isEmpty())
+ return;
+
+ result.append("\n");
+ result.append(" // methods:\n");
+
+ // enlist methods
+ for (final MethodDescriptor methodDescriptor : methods)
+ result.append(methodDescriptor.getEmbeddedDot());
+ }
+
+ public void enlistSuperClass(final StringBuffer result) {
+ if (superClass == null)
+ return;
+
+ if (!superClass.isVisible())
+ return;
+
+ result.append("\n");
+ result.append(" // super class for: " + fullyQualifiedName + "\n");
+
+ result.append(" " + superClass.getGraphId() + " -> " + getGraphId()
+ + "[style=\"tapered\", color=\""
+ + superClass.getSuperClassColor()
+ + "\", penwidth=10, dir=\"forward\"];\n");
+ }
+
+ public void generateDotHeader(final StringBuffer result) {
+ result.append("\n");
+ result.append("// Class: " + fullyQualifiedName + "\n");
+
+ result.append(" " + getGraphId() + "[label=<<TABLE "
+ + getBackgroundColor() + " BORDER=\"" + getBorderWidth()
+ + "\" CELLBORDER=\"1\" CELLSPACING=\"0\">\n");
+
+ result.append("\n");
+ result.append(" // class descriptor header\n");
+ result.append(" <TR><TD colspan=\"2\" PORT=\"f0\">"
+ + "<FONT POINT-SIZE=\"8.0\" >" + getPackageName()
+ + "</FONT><br/>" + "<FONT POINT-SIZE=\"25.0\"><B>"
+ + getClassName(false) + "</B></FONT>" + "</TD></TR>\n");
+ }
+
+ public List<FieldDescriptor> getAllFields() {
+ final List<FieldDescriptor> result = new ArrayList<FieldDescriptor>();
+
+ for (final Map.Entry<String, FieldDescriptor> entry : nameToFieldMap
+ .entrySet())
+ result.add(entry.getValue());
+
+ return result;
+ }
+
+ public String getBackgroundColor() {
+ String bgColor = "";
+
+ if (isEnum)
+ bgColor = "bgcolor=\"navajowhite2\"";
+
+ if (isInterface)
+ bgColor = "bgcolor=\"darkslategray1\"";
+
+ return bgColor;
+ }
+
+ public String getBorderWidth() {
+
+ if (!areReferencesShown())
+ return "4";
+ return "1";
+ }
+
+ public String getClassName(final boolean differentiateArray) {
+
+ final int i = fullyQualifiedName.lastIndexOf('.');
+
+ String result = fullyQualifiedName.substring(i + 1);
+
+ if (isArray)
+ result = result.substring(0, result.length() - 1);
+
+ if (differentiateArray)
+ if (isArray)
+ result += " []";
+
+ return result;
+ }
+
+ public String getColor() {
+ if (getDistinctiveColor() == null)
+ setDistinctiveColor(Utils.getNextDarkColor());
+
+ return getDistinctiveColor();
+ }
+
+ public String getDistinctiveColor() {
+ return distinctiveReferenceColor;
+ }
+
+ @Override
+ public String getDot() {
+ if (!isVisible())
+ return "";
+
+ if (isArray)
+ return "";
+
+ final StringBuffer result = new StringBuffer();
+
+ generateDotHeader(result);
+
+ enlistFields(result);
+
+ enlistMethods(result);
+
+ result.append(" </TABLE>>, shape=\"none\"];\n");
+
+ enlistFieldReferences(result);
+
+ enlistMethodReferences(result);
+
+ enlistImplementedInterfaces(result);
+
+ enlistSuperClass(result);
+
+ return result.toString();
+ }
+
+ @Override
+ public String getEmbeddedDot() {
+ return null;
+ }
+
+ @Override
+ public String getGraphId() {
+ final String result = "class_"
+ + fullyQualifiedName.replace('.', '_').replace(";", "")
+ .replace("[L", "");
+ return result;
+ }
+
+ public String getInterfaceColor() {
+ if (interfaceColor == null)
+ interfaceColor = Utils.getNextLightColor();
+
+ return interfaceColor;
+ }
+
+ public String getPackageName() {
+
+ final int i = fullyQualifiedName.lastIndexOf('.');
+
+ if (i == -1)
+ return "";
+
+ return fullyQualifiedName.substring(0, i).replace("[L", "");
+ }
+
+ // public String getReadableName() {
+ //
+ // // do not print full class name for well known system classes
+ // final String packageName = getPackageName();
+ //
+ // if (packageName.equals("java.util"))
+ // return getClassName();
+ //
+ // if (packageName.equals("java.lang"))
+ // return getClassName();
+ //
+ // return fullyQualifiedName;
+ // }
+
+ public String getSuperClassColor() {
+ if (superClassColor == null)
+ superClassColor = Utils.getNextLightColor();
+
+ return superClassColor;
+ }
+
+ public void indexFields(final Field[] fields) {
+ for (final Field field : fields) {
+ if (nameToFieldMap.containsKey(field.getName()))
+ continue;
+
+ final FieldDescriptor fieldDescriptor = new FieldDescriptor(field,
+ this, dump);
+
+ }
+ }
+
+ private void indexMethods(final Class<? extends Object> clazz) {
+ final Method[] methods = clazz.getMethods();
+
+ for (final Method method : methods)
+ new MethodDescriptor(method, this, dump);
+
+ }
+
+ @Override
+ public boolean isVisible() {
+
+ if (Utils.isSystemDataType(fullyQualifiedName))
+ return false;
+
+ if (Utils.isSystemPackage(fullyQualifiedName))
+ return false;
+
+ return true;
+ }
+
+ public void registerReference() {
+ referenceCount++;
+ }
+
+ public void setDistinctiveColor(final String distinctiveColor) {
+ distinctiveReferenceColor = distinctiveColor;
+ }
+}
--- /dev/null
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.javainspect.structure;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FieldDescriptor implements GraphElement {
+
+ public String name;
+ public ClassDescriptor type;
+ private ClassDescriptor parent;
+ List<ClassDescriptor> typeArguments = new ArrayList<ClassDescriptor>();
+
+ public FieldDescriptor(final Field field, final ClassDescriptor parent,
+ final Graph dump) {
+
+ this.parent = parent;
+
+ if (!field.getDeclaringClass().getName()
+ .equals(parent.fullyQualifiedName))
+ // if field is inherited, do not index it
+ return;
+
+ // if (field.getType().isArray())
+ // System.out.println("field name: " + field.getName());
+
+ parent.nameToFieldMap.put(field.getName(), this);
+
+ name = field.getName();
+ type = dump.addClass(field.getType());
+ type.registerReference();
+
+ final Type genericType = field.getGenericType();
+ if (genericType instanceof ParameterizedType) {
+ final ParameterizedType pt = (ParameterizedType) genericType;
+ for (final Type t : pt.getActualTypeArguments())
+ if (t instanceof Class) {
+ final Class cl = (Class) t;
+ final ClassDescriptor genericTypeDescriptor = dump
+ .addClass(cl);
+ genericTypeDescriptor.registerReference();
+ typeArguments.add(genericTypeDescriptor);
+ }
+
+ }
+ }
+
+ @Override
+ public String getDot() {
+
+ if (!isVisible())
+ return "";
+
+ final StringBuffer result = new StringBuffer();
+
+ // describe associated types
+ for (final ClassDescriptor classDescriptor : typeArguments)
+ if (classDescriptor.isVisible())
+ if (classDescriptor.areReferencesShown())
+ result.append(" " + getGraphId() + " -> "
+ + classDescriptor.getGraphId() + "[label=\"" + name
+ + "\", color=\"" + classDescriptor.getColor()
+ + "\", style=\"bold\"];\n");
+
+ if (!type.isVisible())
+ return result.toString();
+
+ // main type
+ boolean showLink = type.areReferencesShown();
+
+ if (type == parent)
+ showLink = false;
+
+ if (parent.isEnum)
+ showLink = false;
+
+ if (showLink)
+ result.append(" " + getGraphId() + " -> " + type.getGraphId()
+ + "[label=\"" + name + "\"," + " color=\""
+ + type.getColor() + "\", style=\"bold\"];\n");
+
+ return result.toString();
+ }
+
+ @Override
+ public String getEmbeddedDot() {
+
+ if (!isVisible())
+ return "";
+
+ final StringBuffer result = new StringBuffer();
+
+ result.append(" // " + name + "\n");
+ if (parent.isEnum && (type == parent)) {
+ result.append(" <TR><TD colspan=\"2\" PORT=\"" + name);
+ result.append("\" ALIGN=\"left\"><FONT POINT-SIZE=\"11.0\">");
+ result.append(name + "</FONT></TD></TR>\n");
+ } else {
+ result.append(" <TR><td ALIGN=\"right\">");
+ result.append("<FONT POINT-SIZE=\"8.0\">");
+ result.append(type.getClassName(true) + "</FONT>");
+ result.append("</td><TD PORT=\"" + name);
+ result.append("\" ALIGN=\"left\"><FONT POINT-SIZE=\"11.0\">");
+ result.append(name + "</FONT></TD></TR>\n");
+ }
+ return result.toString();
+ }
+
+ @Override
+ public String getGraphId() {
+ return parent.getGraphId() + ":" + name;
+ }
+
+ @Override
+ public boolean isVisible() {
+ if (name.contains("$"))
+ return false;
+
+ if (name.equals("serialVersionUID"))
+ return false;
+
+ return true;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.javainspect.structure;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import eu.svjatoslav.commons.file.CommonPathResolver;
+
+public class Graph {
+
+ /**
+ * Maps class fully qualified names to class descriptors.
+ */
+ Map<String, ClassDescriptor> nameToClassMap = new HashMap<String, ClassDescriptor>();
+
+ public Graph() {
+ }
+
+ public Graph(final Class<? extends Object> clazz) {
+ addClass(clazz);
+ }
+
+ public Graph(final Object root) {
+ addClass(root.getClass());
+ }
+
+ public ClassDescriptor addClass(final Class<? extends Object> clazz) {
+
+ if (clazz == null)
+ return null;
+
+ final String className = clazz.getName();
+
+ if (nameToClassMap.containsKey(className))
+ return nameToClassMap.get(className);
+
+ return new ClassDescriptor(clazz, this);
+ }
+
+ public ClassDescriptor addObject(final Object object) {
+ return addClass(object.getClass());
+ }
+
+ public void generateGraph(final String graphName) {
+ generateGraph(graphName, false);
+ }
+
+ public void generateGraph(final String graphName, final boolean keepDotFile) {
+
+ final String desktopPath = CommonPathResolver.getDesktopDirectory()
+ .getAbsolutePath() + "/";
+
+ final String dotFilePath = desktopPath + graphName + ".dot";
+ final String imageFilePath = desktopPath + graphName + ".png";
+
+ System.out.println("Dot file path:" + dotFilePath);
+
+ try {
+ // write DOT file to disk
+ final PrintWriter out = new PrintWriter(dotFilePath);
+ out.write(getDot());
+ out.close();
+
+ // execute GraphViz to visualize graph
+ try {
+ Runtime.getRuntime()
+ .exec(new String[] { "dot", "-Tpng", dotFilePath, "-o",
+ imageFilePath }).waitFor();
+ } catch (final InterruptedException e) {
+ } finally {
+ }
+
+ if (!keepDotFile) {
+ // delete dot file
+ final File dotFile = new File(dotFilePath);
+ dotFile.delete();
+ }
+ } catch (final IOException e) {
+ System.err.println(e);
+ }
+ }
+
+ private String getDot() {
+ final StringBuffer result = new StringBuffer();
+
+ result.append("digraph Java {\n");
+ result.append("graph [rankdir=LR, overlap = false, concentrate=true];\n");
+
+ for (final Map.Entry<String, ClassDescriptor> entry : nameToClassMap
+ .entrySet())
+ result.append(entry.getValue().getDot());
+
+ result.append("}\n");
+
+ final String resultStr = result.toString();
+ return resultStr;
+ }
+
+}
--- /dev/null
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.javainspect.structure;
+
+public interface GraphElement {
+
+ public String getDot();
+
+ public String getEmbeddedDot();
+
+ public String getGraphId();
+
+ public boolean isVisible();
+
+}
--- /dev/null
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.javainspect.structure;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MethodDescriptor implements GraphElement {
+
+ public String name;
+ public ClassDescriptor returnType;
+ private final ClassDescriptor parent;
+
+ List<ClassDescriptor> typeArguments = new ArrayList<ClassDescriptor>();
+
+ public MethodDescriptor(final Method method, final ClassDescriptor parent,
+ final Graph dump) {
+
+ this.parent = parent;
+
+ name = method.getName();
+
+ if (!method.getDeclaringClass().getName()
+ .equals(parent.fullyQualifiedName))
+ // do not index inherited methods
+ return;
+
+ parent.methods.add(this);
+
+ returnType = dump.addClass(method.getReturnType());
+ returnType.registerReference();
+
+ final Type genericType = method.getGenericReturnType();
+ if (genericType instanceof ParameterizedType) {
+ final ParameterizedType pt = (ParameterizedType) genericType;
+ for (final Type t : pt.getActualTypeArguments())
+ if (t instanceof Class) {
+ final Class cl = (Class) t;
+ final ClassDescriptor classDescriptor = dump.addClass(cl);
+ classDescriptor.registerReference();
+ typeArguments.add(classDescriptor);
+ }
+
+ }
+
+ }
+
+ @Override
+ public String getDot() {
+
+ if (!isVisible())
+ return "";
+
+ final StringBuffer result = new StringBuffer();
+
+ // describe associated types
+ for (final ClassDescriptor classDescriptor : typeArguments)
+ if (classDescriptor.isVisible())
+ if (classDescriptor.areReferencesShown())
+ result.append(" " + getGraphId() + " -> "
+ + classDescriptor.getGraphId() + "[label=\"" + name
+ + "\", color=\"" + classDescriptor.getColor()
+ + "\", style=\"dotted, bold\"];\n");
+
+ if (!returnType.isVisible())
+ return result.toString();
+
+ // main type
+ if (returnType.areReferencesShown())
+ result.append(" " + getGraphId() + " -> "
+ + returnType.getGraphId() + "[label=\"" + name + "\","
+ + " color=\"" + returnType.getColor()
+ + "\", style=\"dotted, bold\"];\n");
+
+ return result.toString();
+ }
+
+ @Override
+ public String getEmbeddedDot() {
+ if (!isVisible())
+ return "";
+
+ final StringBuffer result = new StringBuffer();
+
+ result.append(" // " + name + "\n");
+
+ result.append(" <TR><td ALIGN=\"right\">"
+ + "<FONT POINT-SIZE=\"8.0\">" + returnType.getClassName(true)
+ + "</FONT>" + "</td><TD PORT=\"" + getMethodLabel()
+ + "\" ALIGN=\"left\"><FONT COLOR =\"red\" POINT-SIZE=\"11.0\">"
+ + getMethodLabel() + "</FONT></TD></TR>\n");
+
+ return result.toString();
+ }
+
+ @Override
+ public String getGraphId() {
+ return parent.getGraphId() + ":" + name;
+ }
+
+ public String getMethodLabel() {
+ return name;
+ }
+
+ @Override
+ public boolean isVisible() {
+
+ if (Utils.isSystemMethod(name))
+ return false;
+
+ if (parent.isEnum && Utils.isEnumMethod(name))
+ return false;
+
+ if (!(name.startsWith("get") || name.startsWith("set")))
+ return true;
+
+ final String upprCaseName = name.substring(3).toUpperCase();
+
+ for (String parentField : parent.nameToFieldMap.keySet()) {
+ parentField = parentField.toUpperCase();
+
+ if (upprCaseName.equals(parentField))
+ return false;
+
+ }
+
+ return true;
+ }
+
+}
--- /dev/null
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.javainspect.structure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Utils {
+
+ private static final List<String> systemDataTypes = new ArrayList<String>();
+
+ private static final List<String> systemMethods = new ArrayList<String>();
+
+ private static final List<String> systemPackages = new ArrayList<String>();
+
+ private static final List<String> darkColors = new ArrayList<String>();
+
+ private static final List<String> lightColors = new ArrayList<String>();
+
+ private static final List<String> enumMethods = new ArrayList<String>();
+
+ public static int lastChosenDarkColor = -1;
+
+ public static int lastChosenLightColor = -1;
+
+ static {
+ initEnumMethods();
+ initSystemDataTypes();
+ initDarkColors();
+ initLightColors();
+ initSystemMethods();
+ initSystemPackages();
+ }
+
+ /**
+ * retrieves colors from predefined palette
+ */
+ public static String getNextDarkColor() {
+ lastChosenDarkColor++;
+ if (lastChosenDarkColor >= darkColors.size())
+ lastChosenDarkColor = 0;
+
+ return darkColors.get(lastChosenDarkColor);
+ }
+
+ /**
+ * retrieves colors from predefined palette
+ */
+ public static String getNextLightColor() {
+ lastChosenLightColor++;
+ if (lastChosenLightColor >= lightColors.size())
+ lastChosenLightColor = 0;
+
+ return lightColors.get(lastChosenLightColor);
+ }
+
+ public static void initDarkColors() {
+ darkColors.add("antiquewhite4");
+ darkColors.add("blueviolet");
+ darkColors.add("brown4");
+ darkColors.add("chartreuse4");
+ darkColors.add("cyan4");
+ darkColors.add("deeppink1");
+ darkColors.add("deepskyblue3");
+ darkColors.add("firebrick1");
+ darkColors.add("goldenrod3");
+ darkColors.add("gray0");
+ }
+
+ public static void initEnumMethods() {
+ enumMethods.add("values");
+ enumMethods.add("valueOf");
+ enumMethods.add("name");
+ enumMethods.add("compareTo");
+ enumMethods.add("valueOf");
+ enumMethods.add("getDeclaringClass");
+ enumMethods.add("ordinal");
+ }
+
+ public static void initLightColors() {
+ lightColors.add("olivedrab2");
+ lightColors.add("peachpuff2");
+ lightColors.add("seagreen1");
+ lightColors.add("yellow");
+ lightColors.add("violet");
+ }
+
+ public static void initSystemDataTypes() {
+ systemDataTypes.add("void");
+ systemDataTypes.add("int");
+ systemDataTypes.add("long");
+ systemDataTypes.add("float");
+ systemDataTypes.add("double");
+ systemDataTypes.add("boolean");
+ systemDataTypes.add("char");
+ systemDataTypes.add("short");
+ systemDataTypes.add("byte");
+ }
+
+ public static void initSystemMethods() {
+ systemMethods.add("wait");
+ systemMethods.add("equals");
+ systemMethods.add("toString");
+ systemMethods.add("hashCode");
+ systemMethods.add("notify");
+ systemMethods.add("notifyAll");
+ systemMethods.add("getClass");
+ }
+
+ public static void initSystemPackages() {
+ systemPackages.add("java.");
+ systemPackages.add("javax.");
+ systemPackages.add("sun.");
+ }
+
+ public static boolean isEnumMethod(final String name) {
+ return enumMethods.contains(name);
+ }
+
+ public static boolean isSystemDataType(final String name) {
+ return systemDataTypes.contains(name);
+ }
+
+ public static boolean isSystemMethod(final String name) {
+ return systemMethods.contains(name);
+ }
+
+ public static boolean isSystemPackage(final String name) {
+
+ for (final String packagePrefix : systemPackages)
+ if (name.startsWith(packagePrefix))
+ return true;
+
+ return false;
+ }
+
+}