本文整理了Java中org.eclipse.equinox.p2.metadata.Version.create()
方法的一些代码示例,展示了Version.create()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.create()
方法的具体详情如下:
包路径:org.eclipse.equinox.p2.metadata.Version
类名称:Version
方法名:create
[英]Parses a version identifier from the specified string.
[中]从指定的字符串中解析版本标识符。
代码示例来源:origin: org.eclipse.tycho/org.eclipse.tycho.p2.resolver.impl
public static Version createSiteVersion(String version) {
try {
// try default (OSGi?) format first
return Version.create(version);
} catch (IllegalArgumentException e) {
// treat as raw otherwise
return Version.create("format(n[.n=0;[.n=0;['-'S]]]):" + version);
}
}
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.tycho.p2.resolver.impl
protected Version createVersion(String version) {
return Version.create(version);
}
代码示例来源:origin: org.eclipse.equinox.p2/metadata
Object createInstance(Object arg) {
return Version.create((String) arg);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.engine
public Version getVersion() {
try {
return Version.create(element.getAttribute(ATTRIBUTE_VERSION));
} catch (InvalidRegistryObjectException e) {
return null;
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.engine
public Version getVersion() {
try {
return Version.create(element.getAttribute(ATTRIBUTE_VERSION));
} catch (InvalidRegistryObjectException e) {
return null;
}
}
代码示例来源:origin: org.eclipse.equinox.p2/metadata
@Override
Version coerce(Object v) {
if (v instanceof Version)
return (Version) v;
if (v instanceof String)
return Version.create((String) v);
if (v instanceof String) {
try {
return Version.create((String) v);
} catch (NumberFormatException e) {
//
}
}
throw uncoercable(v);
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.tycho.p2.resolver.impl
@Override
protected Version getVersion() {
return Version.create(product.getVersion());
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.tycho.p2.resolver.impl
protected VersionRange getVersionRange(String version) {
if (version == null) {
return VersionRange.emptyRange;
}
return getVersionRange(Version.create(version));
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.tycho.p2.resolver.impl
@Override
protected Version getVersion() {
return Version.create(feature.getVersion());
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.tycho.p2.resolver.impl
/** see {@link JREAction#generateJREIUData()} */
void parse(String eeName) throws InvalidEENameException {
int idx = eeName.indexOf('-');
if (idx == -1) {
throw new InvalidEENameException(eeName);
}
String name = eeName.substring(0, idx);
name = name.replace('/', '.');
name = name.replace('_', '.');
this.unitName = "a.jre." + name.toLowerCase(Locale.ENGLISH);
String version = eeName.substring(idx + 1);
try {
this.unitVersion = Version.create(version);
} catch (IllegalArgumentException e) {
throw new InvalidEENameException(eeName);
}
}
代码示例来源:origin: org.eclipse.equinox.p2.touchpoint/eclipse
private List<IArtifactKey> findCorrespondinArtifacts(BundleInfo[] bis, IArtifactRepository repo) {
ArrayList<IArtifactKey> toRetain = new ArrayList<IArtifactKey>();
for (int i = 0; i < bis.length; i++) {
// if version is "0.0.0", we will use null to find all versions, see bug 305710
Version version = BundleInfo.EMPTY_VERSION.equals(bis[i].getVersion()) ? null : Version.create(bis[i].getVersion());
IArtifactKey match = searchArtifact(bis[i].getSymbolicName(), version, ARTIFACT_CLASSIFIER_OSGI_BUNDLE, repo);
if (match != null)
toRetain.add(match);
}
return toRetain;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.touchpoint.eclipse
private List<IArtifactKey> findCorrespondinArtifacts(BundleInfo[] bis, IArtifactRepository repo) {
ArrayList<IArtifactKey> toRetain = new ArrayList<IArtifactKey>();
for (int i = 0; i < bis.length; i++) {
// if version is "0.0.0", we will use null to find all versions, see bug 305710
Version version = BundleInfo.EMPTY_VERSION.equals(bis[i].getVersion()) ? null : Version.create(bis[i].getVersion());
IArtifactKey match = searchArtifact(bis[i].getSymbolicName(), version, ARTIFACT_CLASSIFIER_OSGI_BUNDLE, repo);
if (match != null)
toRetain.add(match);
}
return toRetain;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.publisher
private void generateProvidedPackages(List<IProvidedCapability> result) {
String packages = profileProperties.get(PROFILE_SYSTEM_PACKAGES);
if (packages != null && (packages.trim().length() > 0)) {
try {
ManifestElement[] jrePackages = ManifestElement.parseHeader(PROFILE_SYSTEM_PACKAGES, packages);
for (int i = 0; i < jrePackages.length; i++) {
String packageName = jrePackages[i].getValue();
Version packageVersion = Version.create(jrePackages[i].getAttribute("version")); //$NON-NLS-1$
result.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, packageName, packageVersion));
}
} catch (BundleException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.publisher
private void generateProvidedPackages(List<IProvidedCapability> result) {
String packages = profileProperties.get(PROFILE_SYSTEM_PACKAGES);
if (packages != null && (packages.trim().length() > 0)) {
try {
ManifestElement[] jrePackages = ManifestElement.parseHeader(PROFILE_SYSTEM_PACKAGES, packages);
for (int i = 0; i < jrePackages.length; i++) {
String packageName = jrePackages[i].getValue();
Version packageVersion = Version.create(jrePackages[i].getAttribute("version")); //$NON-NLS-1$
result.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, packageName, packageVersion));
}
} catch (BundleException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.publisher
private void generateProvidedPackages(List<IProvidedCapability> result) {
String packages = profileProperties.get(PROFILE_SYSTEM_PACKAGES);
if (packages != null && (packages.trim().length() > 0)) {
try {
ManifestElement[] jrePackages = ManifestElement.parseHeader(PROFILE_SYSTEM_PACKAGES, packages);
for (int i = 0; i < jrePackages.length; i++) {
String packageName = jrePackages[i].getValue();
Version packageVersion = Version.create(jrePackages[i].getAttribute("version")); //$NON-NLS-1$
result.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, packageName, packageVersion));
}
} catch (BundleException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
代码示例来源:origin: org.eclipse.equinox.p2.touchpoint/eclipse
private void addRunningFeatures(IProfile profile, IArtifactRepository repositoryToGC) {
try {
List<Feature> allFeatures = getAllFeatures(Configuration.load(new File(Util.getConfigurationFolder(profile), "org.eclipse.update/platform.xml"), null)); //$NON-NLS-1$
for (Feature f : allFeatures) {
IArtifactKey match = searchArtifact(f.getId(), Version.create(f.getVersion()), ARTIFACT_CLASSIFIER_FEATURE, repositoryToGC);
if (match != null)
artifactKeyList.add(match);
}
} catch (ProvisionException e) {
//Ignore the exception
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.touchpoint.eclipse
private void addRunningFeatures(IProfile profile, IArtifactRepository repositoryToGC) {
try {
List<Feature> allFeatures = getAllFeatures(Configuration.load(new File(Util.getConfigurationFolder(profile), "org.eclipse.update/platform.xml"), null)); //$NON-NLS-1$
for (Feature f : allFeatures) {
IArtifactKey match = searchArtifact(f.getId(), Version.create(f.getVersion()), ARTIFACT_CLASSIFIER_FEATURE, repositoryToGC);
if (match != null)
artifactKeyList.add(match);
}
} catch (ProvisionException e) {
//Ignore the exception
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core
@Override
public int compare(Object o1, Object o2) {
BundleInfo b1 = ((TargetBundle) o1).getBundleInfo();
BundleInfo b2 = ((TargetBundle) o2).getBundleInfo();
try {
Version v1 = Version.create(b1.getVersion());
Version v2 = Version.create(b2.getVersion());
return v1.compareTo(v2);
} catch (IllegalArgumentException e) {
// If one of the bundles has a bad version
PDECore.log(e);
return b1.getVersion().compareTo(b2.getVersion());
}
}
});
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.touchpoint.eclipse
/**
* Returns an IU corresponding to the given artifact key and bundle, or <code>null</code>
* if an IU could not be created.
*/
public static IInstallableUnit createBundleIU(IArtifactKey artifactKey, File bundleFile) {
BundleDescription bundleDescription = BundlesAction.createBundleDescriptionIgnoringExceptions(bundleFile);
if (bundleDescription == null)
return null;
PublisherInfo info = new PublisherInfo();
Version version = Version.create(bundleDescription.getVersion().toString());
AdviceFileAdvice advice = new AdviceFileAdvice(bundleDescription.getSymbolicName(), version, new Path(bundleFile.getAbsolutePath()), AdviceFileAdvice.BUNDLE_ADVICE_FILE);
if (advice.containsAdvice())
info.addAdvice(advice);
String shape = bundleFile.isDirectory() ? IBundleShapeAdvice.DIR : IBundleShapeAdvice.JAR;
info.addAdvice(new BundleShapeAdvice(bundleDescription.getSymbolicName(), version, shape));
return BundlesAction.createBundleIU(bundleDescription, artifactKey, info);
}
代码示例来源:origin: org.eclipse.equinox.p2.touchpoint/eclipse
/**
* Returns an IU corresponding to the given artifact key and bundle, or <code>null</code>
* if an IU could not be created.
*/
public static IInstallableUnit createBundleIU(IArtifactKey artifactKey, File bundleFile) {
BundleDescription bundleDescription = BundlesAction.createBundleDescriptionIgnoringExceptions(bundleFile);
if (bundleDescription == null)
return null;
PublisherInfo info = new PublisherInfo();
Version version = Version.create(bundleDescription.getVersion().toString());
AdviceFileAdvice advice = new AdviceFileAdvice(bundleDescription.getSymbolicName(), version, new Path(bundleFile.getAbsolutePath()), AdviceFileAdvice.BUNDLE_ADVICE_FILE);
if (advice.containsAdvice())
info.addAdvice(advice);
String shape = bundleFile.isDirectory() ? IBundleShapeAdvice.DIR : IBundleShapeAdvice.JAR;
info.addAdvice(new BundleShapeAdvice(bundleDescription.getSymbolicName(), version, shape));
return BundlesAction.createBundleIU(bundleDescription, artifactKey, info);
}
内容来源于网络,如有侵权,请联系作者删除!