下面列出了org.osgi.framework.Filter#toString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Create a {@code ServiceTracker} on the specified {@code Filter} object.
*
* <p>
* Services which match the specified {@code Filter} object will be tracked
* by this {@code ServiceTracker}.
*
* @param context The {@code BundleContext} against which the tracking is
* done.
* @param filter The {@code Filter} to select the services to be tracked.
* @param customizer The customizer object to call when services are added,
* modified, or removed in this {@code ServiceTracker}. If customizer
* is null, then this {@code ServiceTracker} will be used as the
* {@code ServiceTrackerCustomizer} and this {@code ServiceTracker}
* will call the {@code ServiceTrackerCustomizer} methods on itself.
* @since 1.1
*/
public ServiceTracker(final BundleContext context, final Filter filter, final ServiceTrackerCustomizer<S, T> customizer) {
this.context = context;
this.trackReference = null;
this.trackClass = null;
this.listenerFilter = filter.toString();
this.filter = filter;
this.customizer = (customizer == null) ? this : customizer;
if ((context == null) || (filter == null)) {
/*
* we throw a NPE here to be consistent with the other constructors
*/
throw new NullPointerException();
}
}
/**
* Create a {@code ServiceTracker} on the specified {@code Filter} object.
*
* <p>
* Services which match the specified {@code Filter} object will be tracked
* by this {@code ServiceTracker}.
*
* @param context The {@code BundleContext} against which the tracking is
* done.
* @param filter The {@code Filter} to select the services to be tracked.
* @param customizer The customizer object to call when services are added,
* modified, or removed in this {@code ServiceTracker}. If customizer
* is null, then this {@code ServiceTracker} will be used as the
* {@code ServiceTrackerCustomizer} and this {@code ServiceTracker}
* will call the {@code ServiceTrackerCustomizer} methods on itself.
* @since 1.1
*/
public ServiceTracker(final BundleContext context, final Filter filter, final ServiceTrackerCustomizer<S, T> customizer) {
this.context = context;
this.trackReference = null;
this.trackClass = null;
this.listenerFilter = filter.toString();
this.filter = filter;
this.customizer = (customizer == null) ? this : customizer;
if ((context == null) || (filter == null)) {
/*
* we throw a NPE here to be consistent with the other constructors
*/
throw new NullPointerException();
}
}
/**
* Package private constructor used by CoordinationPermissionCollection.
*
* @param filter name filter
* @param mask action mask
*/
CoordinationPermission(Filter filter, int mask) {
super((filter == null) ? "*" : filter.toString());
setTransients(filter, mask);
this.bundle = null;
}
/**
* Package private constructor used by SubsystemPermissionCollection.
*
* @param filter name filter or {@code null} for wildcard.
* @param mask action mask
*/
SubsystemPermission(Filter filter, int mask) {
super((filter == null) ? "*" : filter.toString());
setTransients(filter, mask);
this.subsystem = null;
}