/** * <p>Gets the abbreviated name of a {@code Class}.</p> * * @param cls the class to get the abbreviated name for, may be {@code null} * @param len the desired length of the abbreviated name * @return the abbreviated name or an empty string * @throws IllegalArgumentException if len <= 0 * @see #getAbbreviatedName(String, int) * @since 3.4 */ public static String getAbbreviatedName(final Class<?> cls, final int len) { if (cls == null) { return StringUtils.EMPTY; } return getAbbreviatedName(cls.getName(), len); }
@Test(expected = IllegalArgumentException.class) public void test_getAbbreviatedName_Class_NegativeLen() { ClassUtils.getAbbreviatedName(String.class, -10); }
@Test(expected = IllegalArgumentException.class) public void test_getAbbreviatedName_Class_ZeroLen() { ClassUtils.getAbbreviatedName(String.class, 0); }
@Test public void test_getAbbreviatedName_Class() { assertEquals("", ClassUtils.getAbbreviatedName((Class<?>)null, 1)); assertEquals("j.l.String", ClassUtils.getAbbreviatedName(String.class, 1)); assertEquals("j.l.String", ClassUtils.getAbbreviatedName(String.class, 5)); assertEquals("j.lang.String", ClassUtils.getAbbreviatedName(String.class, 13)); assertEquals("j.lang.String", ClassUtils.getAbbreviatedName(String.class, 15)); assertEquals("java.lang.String", ClassUtils.getAbbreviatedName(String.class, 20)); }
@Test public void test_getAbbreviatedName_String() { assertEquals("", ClassUtils.getAbbreviatedName((String) null, 1)); assertEquals("WithoutPackage", ClassUtils.getAbbreviatedName("WithoutPackage", 1)); assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", 1)); }
/* package private */ void init() { List<AnnotationEditorFactory> exts = new ArrayList<>(); if (extensionsProxy != null) { exts.addAll(extensionsProxy); AnnotationAwareOrderComparator.sort(exts); for (AnnotationEditorFactory fs : exts) { log.info("Found annotation editor: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } extensions = Collections.unmodifiableList(exts); }
/* package private */ void init() { List<ProjectSettingsPanelFactory> exts = new ArrayList<>(); if (extensionsProxy != null) { exts.addAll(extensionsProxy); AnnotationAwareOrderComparator.sort(exts); for (ProjectSettingsPanelFactory fs : exts) { log.info("Found project setting panel: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } extensions = Collections.unmodifiableList(exts); }
public void init() { List<StatementColoringStrategy> fsp = new ArrayList<>(); if (statementColoringStrategiesProxy != null) { fsp.addAll(statementColoringStrategiesProxy); AnnotationAwareOrderComparator.sort(fsp); for (StatementColoringStrategy fs : fsp) { log.info("Found value type support: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } statementColoringStrategies = Collections.unmodifiableList(fsp); }
/* package private */ void init() { Map<String, RecommendationEngineFactory> exts = new HashMap<>(); if (extensionsProxy != null) { for (RecommendationEngineFactory ext : extensionsProxy) { log.info("Found recommendation engine: {}", ClassUtils.getAbbreviatedName(ext.getClass(), 20)); exts.put(ext.getId(), ext); } } extensions = Collections.unmodifiableMap(exts); }
public void init() { List<LayerSupport> lsp = new ArrayList<>(); if (layerSupportsProxy != null) { lsp.addAll(layerSupportsProxy); AnnotationAwareOrderComparator.sort(lsp); for (LayerSupport<?> fs : lsp) { log.info("Found layer support: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } layerSupports = Collections.unmodifiableList(lsp); }
/* package private */ void init() { List<ProjectSettingsPanelFactory> exts = new ArrayList<>(); if (extensionsProxy != null) { exts.addAll(extensionsProxy); AnnotationAwareOrderComparator.sort(exts); for (ProjectSettingsPanelFactory fs : exts) { log.info("Found project setting panel: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } extensions = Collections.unmodifiableList(exts); }
@Override public String toString() { return ClassUtils.getAbbreviatedName(getClass(), 20) + ": " + toStringIdentifier(); }
/* package private */ void init() { List<AnnotationEditorExtension> exts = new ArrayList<>(); if (extensionsProxy != null) { exts.addAll(extensionsProxy); AnnotationAwareOrderComparator.sort(exts); for (AnnotationEditorExtension fs : exts) { log.info("Found annotation editor extension: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } extensions = Collections.unmodifiableList(exts); }
public void init() { List<FeatureSupport> fsp = new ArrayList<>(); if (featureSupportsProxy != null) { fsp.addAll(featureSupportsProxy); AnnotationAwareOrderComparator.sort(fsp); for (FeatureSupport<?> fs : fsp) { log.info("Found feature support: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } featureSupports = Collections.unmodifiableList(fsp); }
public void init() { List<LayerBehavior> lsp = new ArrayList<>(); if (layerBehaviorsProxy != null) { lsp.addAll(layerBehaviorsProxy); AnnotationAwareOrderComparator.sort(lsp); for (LayerBehavior fs : lsp) { log.info("Found layer behavior: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } layerBehaviors = Collections.unmodifiableList(lsp); }
/* package private */ void init() { List<MenuItem> exts = new ArrayList<>(); if (extensionsProxy != null) { exts.addAll(extensionsProxy); AnnotationAwareOrderComparator.sort(exts); for (MenuItem fs : exts) { log.info("Found menu item: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } extensions = Collections.unmodifiableList(exts); }
/* package private */ void init() { List<PhysicalIndexFactory> exts = new ArrayList<>(); if (extensionsProxy != null) { exts.addAll(extensionsProxy); AnnotationAwareOrderComparator.sort(exts); for (PhysicalIndexFactory fs : exts) { log.info("Found index extension: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } extensions = Collections.unmodifiableList(exts); }
public void init() { List<StatementColoringStrategy> fsp = new ArrayList<>(); if (statementColoringStrategiesProxy != null) { fsp.addAll(statementColoringStrategiesProxy); AnnotationAwareOrderComparator.sort(fsp); for (StatementColoringStrategy fs : fsp) { log.info("Found value type support: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } statementColoringStrategies = Collections.unmodifiableList(fsp); }
/* package private */ void init() { List<EventLoggingAdapter<?>> exts = new ArrayList<>(); if (adapterProxy != null) { exts.addAll(adapterProxy); AnnotationAwareOrderComparator.sort(exts); for (EventLoggingAdapter<?> fs : exts) { log.info("Found event logging adapter: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } adapters = Collections.unmodifiableList(exts); }
public void init() { List<FeatureIndexingSupport> fsp = new ArrayList<>(); if (indexingSupportsProxy != null) { fsp.addAll(indexingSupportsProxy); AnnotationAwareOrderComparator.sort(fsp); for (FeatureIndexingSupport fs : fsp) { log.info("Found indexing support: {}", ClassUtils.getAbbreviatedName(fs.getClass(), 20)); } } indexingSupports = Collections.unmodifiableList(fsp); }