What is annotations? In simple terms? - groovy

In Groovy++ I often hear of the term Annotations. Can anyone explain me what is that in simple terms?

In short It's a way to label a piece of code. But it's not Groovy specific thing.
These labels can be used as meta-data by other applications to perform tasks like identifying unit test, dependency injection, or just a way to tell someone that a method is deprecated.
Here is a link to some java documentation.

Some basic info to get you started.
http://groovy.codehaus.org/Annotations+with+Groovy

Related

Extracting Validations using NLP

Considering me a newbie into this but if I want to develop an engine to extract only validations from a technical documents like functional specification. Usually the validations are quick to identify.
If this can be done somehow I can use it for further automation.
I checked and few frameworks are available like
https://opennlp.apache.org/
http://nlp.stanford.edu/
I did few POC's as well , but designing an intelligent engine having generic rules is where I am getting blocked.
Any pointers will be helpful ...
For extracting only validation you need to have the grammar or similar like structure maybe a regular expression. If you dont have ANY idea what type of validation you might face then you can follow un-supervised learning approach. Designing any generic rule is not as easy as it sound so you need to work extra hard for this.

how i do for implement a new algorithm on optaplanner?

For my master thesis I want to implement to optaplanner "reinforcement learning" and test my algorithm with the problems that are modeled in the examples, but I need a guide or any documentation that help me to understand the way. Can you help me?
Get the source code and built it locally. Make sure you fork it on GitHub.
Make sure you understand the scope overview.
Then find the class DefaultLocalSearchSolverPhase and LocalSearchSolverPhaseConfig: start reading code :) For a simpler example, look at AcceptorConfig and LateAcceptanceAcceptor.
A *Config class is a representation of the solver config XML. It builds the actual runtime class * which is used during solving.

adding extra codes at runtime in java

I am developing a library and I need to add extra codes to some of my methods of my objects at run time. there are two points here. first of all, the program I wanted to add extra code, is written before by some body else, and I don't wanted to edit it. second, my work is very similar to adding aspect before calling a method.
After searching and reading on in internet, I found out many frameworks like aspectj, ASPECTWERKZ and etc. that could do this job, but for example the problem with aspectj(when using in spring context) is that it doesn't provide you any API to do your weaving at runtime.
I also found out there are some libraries like ASM and javassist and etc. but they are so general and hard to learn, and my job is more likely to aspects.
So what do you suggest? is there any good library out there? Am I wrong about above libraries i mentioned earlier? Please Help!
With AspectJ you can apply your aspects when classes are loaded at runtime. See Load-Time Weaving documentation. Alternatively, you don't have to change your old code and can apply aspects at compile time.

Does IronRuby support Attributes?

I searched everywhere from google to this site but seems no answer for it. Does anyone know if IronRuby supports clr class attributes? If yes, how?
Thanks in advance.
There's no way to apply CLR attributes in IronRuby today. IronPython support it experimentally with its clrtype module, which uses its own way of overriding the underlying .NET class for a Python object.
If one would want to implement this in IronRuby themselves, it'd be a large undertaking, but not impossible. If anyone is interesting, please ask about it on the mailing list to get started.

Groovy : GUI Builder : creating JTree in Java

I wish to write Java code, but don't like to write swing gui code.
I would like to use Groovy SwingBuilder to build the GUI's.
But I will be writing everything else in Java.
It is very hard to find good examples of using JTree in Groovy.
Anybody that knows some good examples will be appreciated.
And the next step will be how to get this code executed from Java main class.
Any help will be greatly appreciated.
Paluee
The "Mailer User Interface" on this page shows some JTree code. As Don mentioned Griffon greatly eases the pain of Swing. One thing you might want to consider is that we let you mix Java and Groovy code so you could very easily do the UI bits in Groovy and the logic in Java.
Skarab does make a good point. WindowBuilder is a really good UI WYSIWYG for Java code. Using it to create inner views like JPanels and such makes it possible to use a WYSIWYG AND take advantage of all the application lifecycle goodness that Griffon provides.
Disclaimer: I'm a co-founder of Griffon so I'm not exactly the most unbiased on the matter. A book called Griffon in Action which has my other two co-founders as authors is due to release later this year.

Resources