First things first, there are not "two types of URIs in Java": there is only one in Java, and one in EMF which is a framework built for modeling. They have their own implementation of URI because this reflects one of their own concepts, or they needed more than Java's URI allows, or... there can be a number of reasons for such a choice, and many frameworks provide their own version of such or such class (in Eclipse, use ctrl + shift + T and type "List" or "Array" for examples).
As for the actual question, there is no way to go directly from a java.net.URI
to org.eclipse.emf.common.util.URI
: you need to convert the Java URI to a string, then create a new URI around this string. Something like this:
java.net.URI javaURI = profileUrl.toURI();
org.eclipse.emf.common.util.URI emfURI = org.eclipse.emf.common.util.URI.createURI(javaURI.toString());
You need to use the fully qualified name of at least one of the two URIs: the one you did not import in your Java class. Judging by your question, I'd say you have imported org.eclipse.emf.common.util.URI
, and thus can simply use this:
java.net.URI javaURI = profileUrl.toURI();
URI emfURI = URI.createURI(javaURI.toString());