I'm working with the bundle of l2switch-release-beryllium-sr3 and I would like to know the methods of some classes like NodeConnectorRef or Node but I don't find these classes. Someone could tell me where to find them?
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
This is the GitHub of l2switch-beryllium: https://github.com/opendaylight/l2swi...
Thank you.
This is a generated class. The way to generate it is to include the necessary dependencies in your pom file, such as
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-inventory</artifactId>
<version>1.4.0-SNAPSHOT</version>
</dependency>
The Advanced Search by Classname available here.
The presence of ".gen" in the package clearly implies that this is a generated class. You won't find it in the source code. You'd have to build the application to get the class generated.
Related
I am trying to import a custom jar in the node-red java function (https://flows.nodered.org/node/node-red-contrib-java-function), but it is throwing an exception. I debugged and found that the code is added to a test class generated by node red. There are default imports in the class but I cannot find the template used for this pallete.
Any help/pointers are appreciated.
Just FYI for anyone who comes on this path, the java-function node code was updated to let you include custom jars and import statements. This resolves the question
Good evening, I want to use a module as a library on my project. For that I followed some instructions given on some similar questions but with no effect
I'll try to describe my problem as clear as possible.
I have my main project named oncofinder with 2 modules created: oncofinder-gui and oncofinder-core. Let's say I want to import the core model on the gui, like this:
import oncofinder.lib.common;
And I want to declare it like this:
package oncofinder.lib.common;
On the SimpleThreadFactory java class. For that, I would like that the path to be:
oncofinder/oncofinder-core/src/main/java/oncofinder/lib/common/SimpleThreadFactory.java
I already tried to create the library and add it as a dependency as you can see in the follow images:
However, I still get the error:
Package name 'oncofinder.lib.common' does not correspond to the file path '
Any idea what I'm doing wrong and if there is an easier way to import my Modules as dependecies?
Kind Regards
What is the best way to find the right dependency for a used class that are part of the maven-online-repository?
As far I see it is this approach:
lookup the import (e.g. org.whatever.X;) from your code at the maven-repository online (search.maven.org).
Pick one of the result list and include it in the dependency section of the POM.
Hope the chosen version and artifact of the dependency matches your requirements (compiling, runtime). If not try another artifact or version.
I'd like to share my way of doing it. What do you mean by "finding the ... for a used class that are part of the ..."? Do you mean that the dependancy is already used in somewhere else, or that you only know the package name that you may need?
I would first check which version I need for the current project.
If I'm working on a team project and someone has used the dependency in somewhere else, I would check their pom (to ensure we are using the same dependency).
Then I would look up the dependency in Maven repo and include it in my pom.
Hope this helps.
Essentially, yes this is what you have to do to obtain libraries/modules for your project.
Something that's helped me out though with this specific problem: versioning. You can set the versions you need for each of your dependencies with <properties> -> <gson.version>2.8.1</gson.version> (for example). That way, you can guarantee that your build matches with the reqs of the class or type of code you're trying to implement.
Maven doc ref: https://maven.apache.org/pom.html#Properties
I have a bunch of idl files that automatically create four packages, with a lot of java files into it.
I need to insert those java files in a com.bla. package architecture.
Thing is in my generated files I have imports UCO.State for example, that do not fit with my new package architecture.
So question is : Is there a java equivalent to 'import com.bla as bla' ?
The only other option I see is to import the UCO package and rename all UCO.State and other directly by State.
But that would mean refactoring hundreds of files o_O.
Any idea ?
Thanks !
Import all the files in Eclipse. If you manage to get the code compile using the refactor functions of the IDE it will save you all the trouble.
There is no functionality of adding synonyms to the imports in java, but even if there was such how would that have helped you? You still will need to change all your files.
I found the solution, lying in the documentation of my idlj generation tool.
http://docs.oracle.com/javase/1.4.2/docs/guide/rmi-iiop/toJavaPortableUG.html
You should search for information in the pkgTranslate and pkgPrefix options :)
This way, the tool automatically changes foo => com.bla.foo
Problem solved !
There is a java file, which has some dependencies jars. But now, I don't have those jars, and I have to compile it to a .class file.
Is it possible to do this?
UPDATE
Thanks for your answers.
At first, I thought we can create some stubs for the missing dependencies, that's easy but boring. Since we can create the stubs without missing stubs to make the compiler happy, why can't we make a tool do it automatically? The tool doesn't need to create stubs, but reads the java file, collects informations, and then builds the .class files.
But if the "import" statements in the java file contain "*", that will be a problem:
import aaa.*
import bbb.*
public class Hello {
World world;
}
We don't know if the class "World" is under package "aaa" or "bbb". If we are not familiar with the missing dependencies, we even don't know how to create a stub for the class "World".
But if the "import" statements are clear, I think it's possible, but maybe no one will write such a tool
You could go crazy and hand craft the required dependencies as stubs that do nothing except keep the compiler happy.
No. Sorry. You'll need all dependncies in the classpath to compile.
No. But you could provide stubbed-out versions of the dependency class files, if it is only a handful of classes that the code your are trying to compile uses directly.
Then in theory if you take the .class file that compiles and place the real dependencies on the classpath with it your app will work using the correct (non-stubbed-out) dependency classes.
Before any file is compiled it always looks up for any dependencies.
but you said you dont have those jars!!!
see if you can remove the dependencies relation for that project/file and then try to compile it. give it a try!