I am trying to find the javadoc style documentation for Groovy's Process.waitFor() method.
I am currently using the method, so I know it exists.
It is shown in example code on the codehaus website: http://groovy.codehaus.org/Process+Management
Yet, it is not referenced in the Groovy documentation for Process:
http://groovy.codehaus.org/groovy-jdk/java/lang/Process.html
I would think this would be easy to Google for, but so far no luck.
The waitFor method is in Java's Process class
Related
For a Groovy or Java class or method, I would generally include any API-level documentation in a doc comment (aka Javadoc comment), rather than a regular comment. What is the analogous way of adding such comments about a Groovy script?
I personally don't care so much about whether the Javadoc tool picks up the documentation. However, documentation about the purpose of a Groovy script seems conceptually analogous to a doc comment on a class; therefore, I would intuitively expect them to be in a doc comment. If my intuition is wrong and doc tags are not the standard way of commenting the intent of a Groovy script, what is the preferred method to document the purpose of a script?
The syntax section of the Groovy language specification defines the elements that a Groovydoc comment can be associated with:
[Groovydoc] comments are associated with:
type definitions (classes, interfaces, enums, annotations),
fields and properties definitions
methods definitions
Although the compiler will not complain about Groovydoc comments not being associated with the above language elements, you should prepend those constructs with the comment right before it.
A script has no class type definition to put the Groovydoc comment before.
There is an open issue requesting this functionality in the Groovy issue tracker at GROOVY-8877:
Groovydoc doesn't offer any direct way to document Groovy scripts. It will process comments on classes in a Groovy script, but not any sort of file-level or top-level comment.
In summary, script-level Groovydoc comments are not currently supported in a Groovy script file.
In Python, when commenting a function, you can do it in a way that makes it easier for documentation to be automatically generated. They refer to it as a docstring.
Now that I've made an abstract class in Groovy that I'd like to pass around, is there a standard way I should comment it as well? Are there any Groovy tools to generate basic documentation from code comments?
Documenting Groovy with Groovydoc is a nice starting point:
"Groovydoc was introduced in 2007 to provide for Groovy what Javadoc provides for Java. Groovydoc is used to generate the API documentation for the Groovy and Java classes that compose the Groovy language."
What is an example of the use of Application.UnprocessedKeyHandler in Apache Pivot? I've checked Google and the Pivot docs and see no examples, and the Javadoc isn't enlightening. There's a tease of sample code in the mailing list archives, but the code attachment is not available.
Thanks!
The answer is really simple, the Javadoc confused me for some reason. Just add the UnprocessedKeyHandler interface to whatever class in the project is implementing org.apache.pivot.wtk.Application, and then of course implement in that class the methods from the interface.
A start of an example would be to take, say:
public class HelloWorld implements Application
And change it to:
public class HelloWorld implements Application, UnprocessedKeyHandler
The thread that led to this solution can be found here.
First of all, excuse me if I say something obvious because I did not research the answer to this question, it's just something that came to mind and couldn't find an answer to with a quick google search (I also don't know Groovy well).
I'm reading Groovy in action (1st ed) and in section 7.6 it states that "If you want a usual Java class to be recognized as a Groovy class, you only have to implement the GroovyObject interface. For convenience, you can also subclass the abstract class GroovyObjectSupport, which provides default implementations."
So I'm trying out some Java/Groovy (trying to find ways to make coding in Java faster/easier), and I'm instantiating this object Person, which is a Java object and the Person class does not have anything to do with Groovy (i.e. doesn't implement GroovyObject or anything). Person has a protected field, name, with getters/setters. I am able to access this like so in a groovy test case (extends GroovyTestCase), which btw is in a different package and should not be accessible like this:
Person person = new Person('joe')
println "Name: ${person.name}"
Isn't that using the meta info which a Groovy object would have i.e. Groovy would intercept, get the "name" part of "person.name" and call the getName() method or something like that? But person is a Java object... i.e. it shouldn't have that logic available.
I have not implemented GroovyObject or extended GroovyObjectSupport, yet it seems like this Java object has Groovy features I can use.
My question is, what can I assume from Java objects used in Groovy? There is obviously something being done behind the scenes to augment Java defined classes with some Groovy features... but, which features?
So, I guess my question boils down to: "What is done to Java classes when used within a Groovy context?"
Any info regarding the subject would be appreciated, thanks :)
Groovy indeed enhances your Java classes. The problem is when you want to use these enhanced Java classes from Java. Then you need to go for the GroovyObject and GroovyObjectSupport strategy.
About what you can expect, you can check the groovy docs:
the groovy-jdk shows the Groovy enhancements to the JDK
the groovy-api shows the stuff specific from the Groovy library
Also the eclipse plugin works great in autocompleting your Java classes from Groovy.
Java objects are enhanced through Groovy's Meta Object Protocol (MOP), which intercepts and makes its own dispatch to methods and attributes. That is why you can intercept stuff and that's how new methods are added to Java's final classes.
The Groovy's MOP uses cached strategy and reflector classes to achieve a good performance.
You can also read Groovy objects via ObjectInputStream by overriding the resolveClass method and changing the class loader.
See http://www.feiteira.org/2013/04/reading-groovy-objects-from-java.html
Can anyone tell me where com.ibm.xsp.component.UIIncludeComposite is documented? I searched in the help file for UIIncludeComposite but found nothing.
There is only one brief mention of it in Mastering xPages.
com.ibm.xsp.component.UIIncludeComposite is the class for the object returned by getComponent when calling getComponent for a custom control.
In fact where is anything documented? I think the single biggest frustration as a newbie xPage programmer is the lack of documentation or where to find it.
The Java class is documented in the Javadoc available at http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Domino_Designer_Extensibility_APIs_Javadoc_8.5.3 which points to this page for the specific class:
http://public.dhe.ibm.com/software/dw/lotus/Domino-Designer/JavaDocs/DesignerAPIs/com/ibm/xsp/component/UIIncludeComposite.html
General documentation for Upgrade Pack 1 and Extension Library is available here:
http://www-10.lotus.com/ldd/ddwiki.nsf/xpViewCategories.xsp?lookupName=Domino%20Designer%20XPages%20Extension%20Library