本文整理了Java中org.osgi.framework.Version.toString()
方法的一些代码示例,展示了Version.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.toString()
方法的具体详情如下:
包路径:org.osgi.framework.Version
类名称:Version
方法名:toString
[英]Returns the string representation of this version identifier.
The format of the version string will be major.minor.micro if qualifier is the empty string or major.minor.micro.qualifierotherwise.
[中]返回此版本标识符的字符串表示形式。
版本字符串的格式将是主要的。少数的如果限定符是空字符串或主字符串,则为micro。少数的微型的。资格赛则不然。
代码示例来源:origin: org.osgi/org.osgi.core
/**
* Returns the string representation of this version range.
*
* <p>
* The format of the version range string will be a version string if the
* right end point is <i>Infinity</i> ({@code null}) or an interval string.
*
* @return The string representation of this version range.
*/
@Override
public String toString() {
String s = versionRangeString;
if (s != null) {
return s;
}
String leftVersion = left.toString();
if (right == null) {
StringBuffer result = new StringBuffer(leftVersion.length() + 1);
result.append(left.toString0());
return versionRangeString = result.toString();
}
String rightVerion = right.toString();
StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5);
result.append(leftClosed ? LEFT_CLOSED : LEFT_OPEN);
result.append(left.toString0());
result.append(ENDPOINT_DELIMITER);
result.append(right.toString0());
result.append(rightClosed ? RIGHT_CLOSED : RIGHT_OPEN);
return versionRangeString = result.toString();
}
代码示例来源:origin: spring-projects/spring-roo
/**
* This method shows addon info on Spring Roo Shell
*
* @param bundle
* @param bundleVersion
*/
private void addOnInfo(final ObrBundle bundle, final Version bundleVersion) {
logInfo("Name", bundle.getPresentationName());
logInfo("BSN", bundle.getSymbolicName());
logInfo("Version", bundleVersion.toString());
logInfo("JAR Size", bundle.getSize() + " bytes");
logInfo("JAR URL", bundle.getUri());
StringBuilder sb = new StringBuilder();
for (final String command : bundle.getCommands()) {
sb.append(command).append(", ");
}
logInfo("Commands", sb.toString());
}
代码示例来源:origin: com.atlassian.applinks/applinks-plugin-core
@Override
public String marshal(final Version v) throws Exception
{
return v.toString();
}
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
/**
* @return the Java Language Server version
*/
public static String getVersion() {
return context == null ? "Unknown" : context.getBundle().getVersion().toString();
}
代码示例来源:origin: apache/cxf
private String getSwaggerUiRoot(Bundle b, String swaggerUiVersion) {
if (swaggerUiVersion == null) {
swaggerUiVersion = b.getVersion().toString();
}
URL entry = b.getEntry(SwaggerUiResolver.UI_RESOURCES_ROOT_START + swaggerUiVersion);
if (entry != null) {
return entry.toString() + "/";
}
return null;
}
}
代码示例来源:origin: org.jboss.arquillian.container/arquillian-container-osgi
@Override
public void startBundle(String symbolicName, String version) throws Exception {
for (Bundle bundle : syscontext.getBundles()) {
if (bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
bundle.start();
return;
}
}
throw new IllegalStateException("Bundle '" + symbolicName + ":" + version + "' was not found");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-rest-resources
private Collection<Bundle> getMatchingBundles(final String symbolicName, final String version) {
Collection<Bundle> bundles = new ArrayList<>();
for (Bundle b : bundleContext.getBundles()) {
if (b.getSymbolicName().equals(symbolicName) &&
(version == null || b.getVersion().toString().equals(version))) {
bundles.add(b);
}
}
return bundles;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public boolean apply(Bundle input) {
return input.getSymbolicName() != null && input.getVersion() != null &&
symbolicName.matcher(input.getSymbolicName()).matches() &&
(version == null || version.matcher(input.getVersion().toString()).matches());
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public int compare(Bundle o1, Bundle o2) {
int r = NaturalOrderComparator.INSTANCE.compare(o1.getSymbolicName(), o2.getSymbolicName());
if (r!=0) return r;
return VersionComparator.INSTANCE.compare(o1.getVersion().toString(), o2.getVersion().toString());
}
});
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.osgi
/**
* @deprecated
*/
public String getSpecificationVersion() {
return getVersion().toString();
}
代码示例来源:origin: org.eclipse/osgi
/**
* @deprecated
*/
public String getSpecificationVersion() {
return getVersion().toString();
}
代码示例来源:origin: org.apache.aries.application/org.apache.aries.application.utils
public ContentImpl (String bundleSymbolicName, Version version) {
this.contentName = bundleSymbolicName;
this.nameValueMap = new HashMap<String, String>();
nameValueMap.put("version", version.toString());
setup();
}
代码示例来源:origin: org.eclipse/osgi
static Requirement getIdentityRequirement(String name, Version version) {
version = version == null ? Version.emptyVersion : version;
String filter = "(&(" + IdentityNamespace.IDENTITY_NAMESPACE + "=" + name + ")(" + IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE + "=" + version.toString() + "))"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
Map<String, String> directives = Collections.<String, String> singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter);
return new ModuleRequirement(IdentityNamespace.IDENTITY_NAMESPACE, directives, Collections.<String, Object> emptyMap(), null);
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
private static String formatVersion(String version) {
try {
Version v = new Version(version);
return v.toString();
} catch (IllegalArgumentException e) {
}
return version;
}
代码示例来源:origin: org.apache.aries.application/org.apache.aries.application.resolver.obr
public String getVersion() {
logger.debug(LOG_ENTRY, "getVersion");
String result = resource.getVersion().toString();
logger.debug(LOG_EXIT, "getVersion", result);
return result;
}
代码示例来源:origin: org.eclipse/osgi
public static BundleDTO newBundleDTO(Bundle bundle) {
if (bundle == null) {
return null;
}
BundleDTO dto = new BundleDTO();
dto.id = bundle.getBundleId();
dto.lastModified = bundle.getLastModified();
dto.state = bundle.getState();
dto.symbolicName = bundle.getSymbolicName();
dto.version = bundle.getVersion().toString();
return dto;
}
代码示例来源:origin: org.apache.aries.application/org.apache.aries.application.modeller
/**
* Get the bundle or composite's version
* @return version
*/
public String getVersion () {
String result = String.valueOf(getAttributes().get(Constants.VERSION_ATTRIBUTE));
return Version.parseVersion(result).toString();
}
代码示例来源:origin: inspectIT/inspectIT
/**
* {@inheritDoc}
*/
@Override
public String readVersion() throws InvalidVersionException {
return InspectIT.getDefault().getBundle().getVersion().toString();
}
代码示例来源:origin: org.eclipse/org.eclipse.osgi
private void setFrameworkVersion(BundleDescription systemBundle) {
ExportPackageDescription[] packages = systemBundle.getExportPackages();
for (int i = 0; i < packages.length; i++)
if (packages[i].getName().equals(Constants.OSGI_FRAMEWORK_PACKAGE)) {
FrameworkProperties.setProperty(Constants.FRAMEWORK_VERSION, packages[i].getVersion().toString());
break;
}
FrameworkProperties.setProperty(Constants.OSGI_IMPL_VERSION_KEY, systemBundle.getVersion().toString());
}
代码示例来源:origin: stackoverflow.com
private Boolean processPluginUpgrading() {
final Version version = getDefault().getBundle().getVersion();
final IPreferenceStore preferenceStore = getDefault().getPreferenceStore();
final String preferenceName = "lastVersionActivated";
final String lastVersionActivated = preferenceStore.getString(preferenceName);
final boolean upgraded =
"".equals(lastVersionActivated)
|| (version.compareTo(new Version(lastVersionActivated)) > 0);
preferenceStore.setValue(preferenceName, version.toString());
return upgraded;
}
内容来源于网络,如有侵权,请联系作者删除!