< prev index next >

core/org.openjdk.jmc.flightrecorder.rules/src/main/java/org/openjdk/jmc/flightrecorder/rules/util/RulesToolkit.java

Print this page

        

*** 109,129 **** private static final String REC_SETTING_NAME_ENABLED = "enabled"; //$NON-NLS-1$ private static final String REC_SETTING_NAME_THRESHOLD = "threshold"; //$NON-NLS-1$ public static final String REC_SETTING_NAME_PERIOD = "period"; //$NON-NLS-1$ public static final String REC_SETTING_PERIOD_EVERY_CHUNK = "everyChunk"; //$NON-NLS-1$ private static final IAccessorFactory<String> TYPE_NAME_ACCESSOR_FACTORY = new IAccessorFactory<String>() { - @Override ! public <T> IMemberAccessor<String, T> getAccessor(IType<T> type) { final IMemberAccessor<LabeledIdentifier, T> ta = JdkAttributes.REC_SETTING_FOR.getAccessor(type); return new IMemberAccessor<String, T>() { - @Override public String getMember(T inObject) { LabeledIdentifier eventType = ta.getMember(inObject); ! return eventType == null ? null : eventType.getName(); } }; } }; --- 109,131 ---- private static final String REC_SETTING_NAME_ENABLED = "enabled"; //$NON-NLS-1$ private static final String REC_SETTING_NAME_THRESHOLD = "threshold"; //$NON-NLS-1$ public static final String REC_SETTING_NAME_PERIOD = "period"; //$NON-NLS-1$ public static final String REC_SETTING_PERIOD_EVERY_CHUNK = "everyChunk"; //$NON-NLS-1$ + /* + * Returns the type name, as available in the recording settings, or simply the type id, if not + * available. + */ private static final IAccessorFactory<String> TYPE_NAME_ACCESSOR_FACTORY = new IAccessorFactory<String>() { @Override ! public <T> IMemberAccessor<String, T> getAccessor(final IType<T> type) { final IMemberAccessor<LabeledIdentifier, T> ta = JdkAttributes.REC_SETTING_FOR.getAccessor(type); return new IMemberAccessor<String, T>() { @Override public String getMember(T inObject) { LabeledIdentifier eventType = ta.getMember(inObject); ! return eventType == null ? type.getIdentifier() : eventType.getName(); } }; } };
*** 953,962 **** --- 955,965 ---- private static String getEventTypeNames(IItemCollection items) { Set<String> names = items.getAggregate(Aggregators.distinct("", TYPE_NAME_ACCESSOR_FACTORY)); //$NON-NLS-1$ if (names == null) { return null; } + List<String> quotedNames = new ArrayList<>(); for (String name : names) { quotedNames.add("'" + name + "'"); //$NON-NLS-1$ //$NON-NLS-2$ } Collections.sort(quotedNames);
< prev index next >