How to build map of classes in my application? - java

I want to order my application for documention. this any tool that in java that support in this?
I know and use java doc. I want to "draw" my application. to see all the connections and "tree" of classes between them. Do anybody know if this option is exsists in any Ide or platform?

You can use eclipse(or any other IDE) to Java doc your methods and classes, and when you want to document it si,ply go to Project - Genereate javadoc

Do you probably mean javadoc? In this case add special comments to your classes and methods that start with /** instead of regular /* and then use command line utility javadoc or higher level tools provided by ant, maven or other build tools.

Related

Add copyright at the end of Java class while writing documentation?

I'm writing documentation for my java file. In that documentation, I want to add some html links at the end of each generated file. For that, what I have to use while writing java documentation?
If you are using Eclipse as IDE, you can use the plugin JAutodoc:
http://jautodoc.sourceforge.net/
To add a default text at the beggining of each text file.
According to the javadoc manual (can't find a newer version right now), you should use -footer when you generate your java API documentation from the CLI, for instance:
javadoc -footer "<b>Copyright 2015 Lakshmi Prasanna</b><br>" com.mypackage
Here's a similar example, but that uses -header instead.
Now, if you use a good IDE, at the very least it should allow you to type that somewhere in the project settings. Back in the day Eclipse wasn't very flexible, so I had to make an Ant script (yuck).
EDIT:
One limitation with this approach is that the CLI -options depend on the tool. This works with the standard javadoc command but might not work with another vendor's doclet. However I'm not sure there's a universal way to achieve what the OP asked.
Anyway, it seems to be: NOT -footer but -bottom.

Does (or will) the JRE include a CLI parser

I normally use known CLI parsers (external libraries):
Apache Commons CLI http://commons.apache.org/cli/ (version 1.2)
Java Gems http://code.google.com/p/javagems/
JArgs http://jargs.sourceforge.net/
...
I haven't found one in the standard Java library, and I wonder if new versions of Java are providing an implementation so I can save a dependency. Does anyone know if there is something like that or a plan to include it in the future?
If when you say "native" you mean "java implementation included into JDK", the answer is "no". Obviously you can always create your own (more or less simple) parser based on arrays and string operations provided by java and JDK.
Concerning to choice among java CLI parsers I'd suggest you to use arg4j and can refer you to the following discussion: Java library for parsing command-line parameters?
One of the answers contains a very long list of libraries.
And the last note. I do not know why do you want to "save the dependencies". Use one of build tools that manage your dependencies (e.g. ivy, maven, gradle) and forget about such problems. if you want to distribute your program as a single jar, you can pack all your dependencies together with your application. Both maven and gradle can do this. If you want to achieve minimal jar size ... make your choice: what is more important for you - size or modularity. In most cases size is not an issue these days.
I don't think there is anything included in the JDK. Actually OpenJDK itself uses JOpt Simple (see comment at the bottom of the page).

How to use core Java classes in Papyrus UML (Eclipse)?

I'm new to Papyrus UML in Eclipse. I'm trying to make a class diagram of classes that also use standard Java classes (e.g. java.awt.Point). So for example: Class Tracker has a property Point location. However, if I click the property location, I cannot set its type to any standard Java class.
I tried Import from registered library but there are no options that include the standard Java packages.
How can I use these standard classes in my class diagram?
Some Papyrus/Java lover should write the core java profile and donate it to the papyrus project.
You can not use Papyrus with Java existing java code. Usually you model then generate a java code from the model.
You can try the reverse engineering feature but it would create model which is now not related to your existing java class.
The only solution I see is to use live code and model synchronization UML tool.
After much searching, i found a way..
Simply download the Java Core (JCL) API UML file I made here:
https://mega.nz/#!qVdAAAIL!gWstAOCyQFWVHTqxVrgnYssiOJZSAEN-rbxMIaZzMJo
And use the model->import->import package from user model functionality in papyrus in eclipse
Then you can use standard java library types outside of just primitives in your papyrus UML diagram.
I've tested this with the code generator and it works with one caveat, you end up with an extra local copy of the standard library packages in the generated project. Simply delete these and you can move on with your day. I'm not sure, but eclipse payprus codegen doesn't currently seem to generate the imports necessary, so you'll have to do that manually or let the IDE do it for you, but it sure beats having placeholder types.
If you're wondering how this was done, I used the following plugin:
https://marketplace.eclipse.org/content/jar2uml
To generate a UML file for the standard library jar file version 1.8, this is usually under the jre installation directory inside the lib folder.
This gave me a model with all the standard library packages within it, but the model was named rt.java.* instead of java.* which messed with the code generation process. So i simply removed the other packages other than java.* and made java the model itself instead of a package.
There is a java profile and library/package in Papyrus Software Designer extention.
You may install it via the market place.
See also: https://wiki.eclipse.org/Java_Code_Generation

JavaDoc for joint java + groovy project

I have a project that uses Java and Groovy intermixed. This works very well.
However, I want to create the javadoc for this. I know the javadoc creation for plain java projects. But for a combination of Groovy and Java, I have not found such a tool. Is there something out there?
Well, there is a tool (unimaginatively) named Groovydoc, which works by way of an Ant task.
As far as I see, it also works as a drop-in replacement for javadoc on Java classes, so I suspect it would work on a mixed Java/Groovy project.

Is there something like JET (Java Emitter Templates) but without Eclipse-dependencies?

I wanted to use JET (Java Emitter Templates)
in my Netbeans projects, but had to find out that JET
heavily depends on Eclipse libraries.
Is there something similar to JET, but as a standalone project?
Something which is open source and well maintained?
Futhermore, is "code generation" the common term for such tools?
If you are using Maven, you can use JET templates with the maven-jet-plugin.
This seems to be the source code. And here the documentation.
It is not actively maintained but works pretty well and follows the JET spec.
I've used it with templates and skeletons.
It's self contained, doesn't depend on Eclipse, and doesn't introduce any transitive dependencies to your project.
Indeed JET is very tied with Eclipse.
If you want to generate code without Eclipse you should use another solution.
You can choose another template engine like Velocity (https://velocity.apache.org/) or FreeMarker (https://freemarker.apache.org/).
Or you can choose a code generator working by itself independently of any IDE.
For example "Telosys Command Line Interface" : http://www.telosys.org/
From what I know, JET is something like JSP, no?
Java Emitter Templates are very similar to Java Server Pages (JSPs). Both JETs and JSPs use the same syntax, and are compiled to Java behind the scenes. Both are used to separate the responsibility for rendering pages from the model and controller. Both accept objects passed into them as an input argument, both allow inserting string values within code ("expressions"), and allow direct use of Java code to perform loops, declare variable, or perform logical flows ("scriptlets"). Both are good ways of representing the structure of a generated object (web page, Java class, or file) while supporting customization of the details.
JETs differ from JSPs in a few key ways. In a JET, the structure of the markup may be changed to support generating code in different languages. Typically the input to a JET will be a configuration file and not user input (though there is nothing forbidding this). And also typically, JET processing will take place only once for a given workflow. These are not technical limitations, and you may find uses for JETs which are quite different...
ibm.com
Here are a few links to get you started on JSP, if that sounds like what you need:
sun.com
netbeans.org
Look for "template engine" for these types of tools.
A couple you might want to look at:
Apache Velocity (http://velocity.apache.org/)
StringTemplate (http://stringtemplate.org/)
I ended up using ERB (Ruby's template engine).
Works great in Netbeans!
I define custom ant task which generates source files by calling ERB (whose results are placed inside a non-versioned special directory).
The ant task is overriding Netbeans' "-pre-compile" task.

Categories