Pass command-line argument to schemacrawler programmatically - java

I'm using SchemaCrawler v14.21.02 programmatically in my Java project to generate schema diagrams. I would like to generate a diagram with a reduced set of columns, as done by adding the option -infolevel=standard -command=brief when running SchemaCrawler from the command line.
My question is: how do I pass this option when running SchemaCrawler programmatically?
I have found the SchemaInfoLevel and SchemaInfoLevelBuilder classes in package schemacrawler.schemacrawler, but the -command=brief option eludes me.

Please take a look at the example code provided as part of the SchemaCrawler project, at ExecutableExample.java. I have highlighted the relevant parts of the code, if you click on the link.
Sualeh Fatehi, SchemaCrawler

Related

Create a shortcut for system.out.println in visual studio code

I am using visual studio code IDE for my Java project and I want to create a shortcut for:
System.out.println();
That is if I write sysout or something like that it will automatically changed to System.out.println(); with cursor inside parenthesis.
Is there any way it can be achieved in VScode?
There is no need to define the snippet yourself. You can install https://marketplace.visualstudio.com/items?itemName=redhat.java, which contains the predefined snippet for your case (and more than that), here are some screenshot:
sysout:
syserr:
and even systrace:
If you want to developing your Java application in VS Code, you can also install https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack, which provides debugging, testing, project managing capabilities to you.
As mentioned by #vaibhavsahu in the comments you can create user defined snippets in VSCode: https://code.visualstudio.com/docs/editor/userdefinedsnippets
Here's a relevant excerpt from that document which shows where to locate the user defined snippets file:
You can easily define your own snippets without any extension. To create or edit your own snippets, select User Snippets under File > Preferences (Code > Preferences on macOS), and then select the language (by language identifier) for which the snippets should appear, or the New Global Snippets file option if they should appear for all languages. VS Code manages the creation and refreshing of the underlying snippets file(s) for you.
So in your case you'd go to File (or Code on macOS) > Preferences > User Defined Snippets and then type in Java, this should open a java.json file (which contains an example user defined snippet commented out).
I think this snippet would do it for what you're trying to accomplish:
"System.out.println(placeholder)": {
"prefix": "sysout",
"body" : ["System.out.println(${1:string})"],
"description" : "System out println with placeholder in parens"
}
Then when you start typing sysout in a .java file IntelliSense should show the recommendation for the code snippet, when you enter enter it should be substituted in with your placeholder in the parens.
Edit:
The System.out.println(placeholder) from the java.json file is just what displays in the IntelliSense dropdown, you could make it System print or whatever you'd like so that you'll recognize it. The actual code which gets substituted is in the "body"
this extension or plugin can meet your need
https://marketplace.visualstudio.com/items?itemName=ricardo-emerson.java-sysout

Validate Gherkin Feature File

I used IntelliJ to write Cucumber feature files i.e., *.feature files and corresponding step definition files in Java within the IDE. The user experience is great and IDE opens up its IntelliSense showing all valid options for which the step definitions exist. If I write a new step in a scenario or a step that has no corresponding step definition exist already in the Java file, it highlights the step with different colour and similarly if regex don't match. I get informed by this highlighting that something has to be written for this step in Java file or the step is wrong and will not execute.
I need the same functionality on a non developer machine i.e., on a Business Analyst or Product owner machine, where there is no IDE installed but just an editor like Notepad++. I know about the Notepad++ plug-in for Gherkin but it doesn't highlight the step for which step definition is missing in the *.java step definition file. Please suggest any editor or free IDE that has similar plug-in available.
Thanks,
Shany
In case you use JIRA to manage your stories then you can use a JIRA plugin which has Auto-complete, parameter highlight functionality. There are other similar plugins you can browse.

attract attributes typing java plugin for rhapsody

I need to write a java plugin will draw on the attributes using the rhapsody . What do you recommend for that. Where should I start ? Previously I did not write plug-ins.
First place to start is to look at the samples provided by IBM. You can find them (on Windows 7, version 7.5.3 of Rhapsody) in:
C:\Users\\IBM\Rational\Rhapsody\7.5.3\Samples\ExtensibilitySamples
There are 3 types you can create:
1. A plugin (what you are asking about)
2. A Check plugin (ties into the model check sub-system)
3. Event callback plugin (don't know much about this one)
I've written 1 and 2.
There should be a how-to document in and around that directory area that walks you through creating a simple plugin. If not, it probably is available in the Rhapsody help (from within the tool)
Basically, you write your Java plugin to conform to a specific interface that IBM provides(com.telelogic.rhapsody.core.RPUserPlugin), create a .hep file that describes the details of that, and then drop the .hep file into the .rpy folder of your project. You then create a new profile in your model with the same name as your .hep file and that should link to the .hep information.
A sample .hep file looks like this:
[Helpers]
numberOfElements=1
#REM: Tranformer Generation plug-in
name1=Generate Transformers
JavaMainClass1=sida.jni.transformerplugin.TransformerPlugin
JavaClassPath1=..\TransformerPlugin\DefaultConfig
isPlugin1=1
isVisible1=1
DLLServerCompatible1=1
Take special note of the numbers added to the end of the attribute names:
ex. isPlugin1, isVisible1
You will want to match that to the name# attribute in the file.
Then make sure your java plugin class files are on the classpath or (better yet), co-located to your .rpy folder. For example, our plugins sit in a folder right next to (at the same level as) our .rpy folder.
If all goes well, you should see an initialization string spit out in the Rhapsody console window for the plugin.
Hope this gets you started...

Getting documention to appear in intellitext window using eclispe and java

When using the standard api, for example the collections library, the predictive text options windows also shows the comments on class/methods.
however when I do the same style comments on my own code - the open project I am working on (code completion works correctly, just no comments appear), and then reference it later. These comments are not displayed. I get the correct code completion options, just none of the associated comments/documentation. They are not in jar, they are source files, that are built using maven into a war file.
Is there a setting I need to enable in eclipse, or do I need to set up javadoc or something ?
How embarassing, you to have to specify double asterix at the begininng of comment to create a javdoc comment
/**
* read the documentation before asking questions on stackoverlow
*/
If the class is part of a jar you need to associate the javadoc jar or path. You can right click on the jar in eclipse and specify the path in the properties dialog.

Eclipse command line formatting of Java code

Is there a command line way to invoke the java code formatting feature of Eclipse?
Also, is there a way to configure the way it formats the code via command line?
The goal is to have a common code formatting mechanism for the entire team and automate that step prior to check in of code.
ajay try this post, there are some step-by-step instructions included here.
Have a look at the JDT application org.eclipse.jdt.core.JavaCodeFormatter.
I haven't tried this out, but you should be able to start eclipse as
eclipse -application org.eclipse.jdt.core.JavaCodeFormatter -all...other...options
See org.eclipse.jdt.core.formatter.CodeFormatterApplication for the available options.
You can create specific format xml and whole team can use that
Windows/Preference/java/formatter/Configure project specific setting , here we can edit and create customized format xml .Others can import this xml . Not very sure about command line
I know of no way from command line. Have you looked at Save Actions?
Preferences => Java => Editor => Save Actions let you format all code whenever it's saved. If everyone uses Eclipse, you can distribute your standard formatting XML file and use Save Actions to take the manual step out of formatting.
The downside, of course, is that everyone has to use the same project settings.

Categories