本文整理汇总了Java中org.osgi.framework.Version.getQualifier方法的典型用法代码示例。如果您正苦于以下问题:Java Version.getQualifier方法的具体用法?Java Version.getQualifier怎么用?Java Version.getQualifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgi.framework.Version
的用法示例。
在下文中一共展示了Version.getQualifier方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Version4Digit
import org.osgi.framework.Version; //导入方法依赖的package包/类
public Version4Digit(String versionString) {
try {
Version v = new Version(versionString);
major = v.getMajor();
minor = v.getMinor();
micro = v.getMicro();
qualifier = v.getQualifier();
} catch (IllegalArgumentException eae) {
// this isn't a valid OSGI Version but we want to support 1.2.3.4+ Versions
String[] bits = versionString.split("\\.");
if (bits.length != 4) {
throw eae; // throw the original exception
}
try {
major = Integer.parseInt(bits[0]);
minor = Integer.parseInt(bits[1]);
micro = Integer.parseInt(bits[2]);
} catch (NumberFormatException e) {
throw eae; // throw the original exception
}
qualifier = bits[3];
}
}
示例2: createVersionText
import org.osgi.framework.Version; //导入方法依赖的package包/类
private static void createVersionText() {
final Version version = TourbookPlugin.getDefault().getVersion();
final String qualifier = version.getQualifier();
_isDev = qualifier.contains("qualifier"); //$NON-NLS-1$
_qualifierText = _isDev ? //
//
// this text is used to identify development versions
DEVELOPMENT_VERSION_TEXT
//
: qualifier;
_qualifierText += _subVersion;
_versionSimple = UI.EMPTY_STRING
+ version.getMajor()
+ UI.SYMBOL_DOT
+ version.getMinor()
+ UI.SYMBOL_DOT
+ version.getMicro();
_versionFull = _versionSimple + UI.SYMBOL_DOT + _qualifierText;
}
示例3: start
import org.osgi.framework.Version; //导入方法依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(), new DefaultModelElementClassProvider(providerVersion, XYPlotActor.class),
null);
}
示例4: start
import org.osgi.framework.Version; //导入方法依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(),
new DefaultModelElementClassProvider(providerVersion, SizeAttribute.class, WindowPropertiesAttribute.class), null);
}
示例5: start
import org.osgi.framework.Version; //导入方法依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(), new DefaultModelElementClassProvider(providerVersion, PythonActor.class),
null);
}
示例6: start
import org.osgi.framework.Version; //导入方法依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(), new DefaultModelElementClassProvider(providerVersion, TaskBasedActor.class),
null);
}
示例7: doExport_21_Creator
import org.osgi.framework.Version; //导入方法依赖的package包/类
private void doExport_21_Creator(final VelocityContext vcContext) {
final Version version = Activator.getDefault().getVersion();
/*
* Version
*/
String pluginMajorVersion = ZERO;
String pluginMinorVersion = ZERO;
String pluginMicroVersion = ZERO;
String pluginQualifierVersion = ZERO;
if (version != null) {
pluginMajorVersion = Integer.toString(version.getMajor());
pluginMinorVersion = Integer.toString(version.getMinor());
pluginMicroVersion = Integer.toString(version.getMicro());
pluginQualifierVersion = version.getQualifier();
}
vcContext.put("pluginMajorVersion", pluginMajorVersion); //$NON-NLS-1$
vcContext.put("pluginMinorVersion", pluginMinorVersion); //$NON-NLS-1$
vcContext.put("pluginMicroVersion", pluginMicroVersion); //$NON-NLS-1$
vcContext.put("pluginQualifierVersion", pluginQualifierVersion); //$NON-NLS-1$
/*
* Creator
*/
String creatorText = String.format("MyTourbook %d.%d.%d.%s - http://mytourbook.sourceforge.net",//$NON-NLS-1$
version.getMajor(),
version.getMinor(),
version.getMicro(),
version.getQualifier());
if (_exportState_GPX_IsExportWithBarometer) {
creatorText += STRAVA_WITH_BAROMETER;
}
vcContext.put("creator", creatorText); //$NON-NLS-1$
}
示例8: isNewerThan
import org.osgi.framework.Version; //导入方法依赖的package包/类
/**
* check left value against right value
*
* @param left
* @param right
* @return returns if right is newer than left
*/
public static boolean isNewerThan(final Version left, final Version right) {
// major
if(left.getMajor()>right.getMajor()) return true;
if(left.getMajor()<right.getMajor()) return false;
// minor
if(left.getMinor()>right.getMinor()) return true;
if(left.getMinor()<right.getMinor()) return false;
// micro
if(left.getMicro()>right.getMicro()) return true;
if(left.getMicro()<right.getMicro()) return false;
// qualifier
// left
String q = left.getQualifier();
int index=q.indexOf('-');
String qla = index==-1?"":q.substring(index+1).trim();
String qln=index==-1?q:q.substring(0, index);
int ql = isEmpty(qln)?Integer.MIN_VALUE:Integer.parseInt(qln);
//right
q = right.getQualifier();
index=q.indexOf('-');
String qra = index==-1?"":q.substring(index+1).trim();
String qrn=index==-1?q:q.substring(0, index);
int qr = isEmpty(qln)?Integer.MIN_VALUE:Integer.parseInt(qrn);
if(ql>qr) return true;
if(ql<qr) return false;
int qlan=qualifierAppendix2Number(qla);
int qran=qualifierAppendix2Number(qra);
if(qlan>qran) return true;
if(qlan<qran) return false;
if(qlan==QUALIFIER_APPENDIX_OTHER && qran==QUALIFIER_APPENDIX_OTHER)
return left.compareTo(right) > 0;
return false;
}
示例9: isNewerThan
import org.osgi.framework.Version; //导入方法依赖的package包/类
/**
* check left value against right value
*
* @param left
* @param right
* @return returns if right is newer than left
*/
public static boolean isNewerThan(final Version left, final Version right) {
// major
if(left.getMajor()>right.getMajor()) return true;
if(left.getMajor()<right.getMajor()) return false;
// minor
if(left.getMinor()>right.getMinor()) return true;
if(left.getMinor()<right.getMinor()) return false;
// micro
if(left.getMicro()>right.getMicro()) return true;
if(left.getMicro()<right.getMicro()) return false;
// qualifier
// left
String q = left.getQualifier();
int index=q.indexOf('-');
String qla = index==-1?"":q.substring(index+1).trim();
String qln=index==-1?q:q.substring(0, index);
int ql = StringUtil.isEmpty(qln)?Integer.MIN_VALUE:Caster.toIntValue(qln, Integer.MAX_VALUE);
//right
q = right.getQualifier();
index=q.indexOf('-');
String qra = index==-1?"":q.substring(index+1).trim();
String qrn=index==-1?q:q.substring(0, index);
int qr = StringUtil.isEmpty(qln)?Integer.MIN_VALUE:Caster.toIntValue(qrn, Integer.MAX_VALUE);
if(ql>qr) return true;
if(ql<qr) return false;
int qlan=qualifierAppendix2Number(qla);
int qran=qualifierAppendix2Number(qra);
if(qlan>qran) return true;
if(qlan<qran) return false;
if(qlan==QUALIFIER_APPENDIX_OTHER && qran==QUALIFIER_APPENDIX_OTHER)
return left.compareTo(right) > 0;
return false;
}
示例10: getStateAsString
import org.osgi.framework.Version; //导入方法依赖的package包/类
private static String getStateAsString(Version version) {
String q = version.getQualifier();
int index=q.indexOf('-');
if(index==-1) return "stable";
return q.substring(index+1);
}