当前位置: 首页>>代码示例>>Java>>正文


Java Description类代码示例

本文整理汇总了Java中beast.core.Description的典型用法代码示例。如果您正苦于以下问题:Java Description类的具体用法?Java Description怎么用?Java Description使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Description类属于beast.core包,在下文中一共展示了Description类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDescriptions

import beast.core.Description; //导入依赖的package包/类
/**
 * Check all plug-ins have a proper description so that
 * everything is at least moderately well documented. *
 */
@Test
public void testDescriptions() {
    final List<String> pluginNames = AddOnManager.find(beast.core.BEASTObject.class, AddOnManager.IMPLEMENTATION_DIR);
    final List<String> undocumentedPlugins = new ArrayList<String>();
    for (final String beastObjectName : pluginNames) {
        try {
            final Class<?> pluginClass = Class.forName(beastObjectName);
            final Annotation[] classAnnotations = pluginClass.getAnnotations();
            boolean hasSatisfactoryDescription = false;
            for (final Annotation annotation : classAnnotations) {
                if (annotation instanceof Description) {
                    final Description description = (Description) annotation;
                    final String descriptionString = description.value();
                    if (isProperDocString(descriptionString)) {
                        hasSatisfactoryDescription = true;
                    }
                }
            }
            if (!hasSatisfactoryDescription) {
                undocumentedPlugins.add(beastObjectName);
            }
        } catch (Exception e) {
        }
    }
    assertTrue("No proper description for: " + undocumentedPlugins.toString(), undocumentedPlugins.size() == 0);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:31,代码来源:DocumentationTest.java

示例2: getInheritableDescription

import beast.core.Description; //导入依赖的package包/类
/**
 * Extract description from @Description annotation
 * but only if the description is inheritable *
 */
String getInheritableDescription(Class<?> beastObjectClass) {
    String str = "";
    Class<?> superClass = beastObjectClass.getSuperclass();
    if (superClass != null) {
        String superName = getInheritableDescription(superClass);
        if (superName != null) {
            str += superName + "<br/>";
        }
    }
    Annotation[] classAnnotations = beastObjectClass.getAnnotations();
    for (Annotation annotation : classAnnotations) {
        if (annotation instanceof Description) {
            Description description = (Description) annotation;
            if (description.isInheritable()) {
                str += description.value();
            } else {
                return null;
            }
        }
    }
    return str;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:27,代码来源:DocMaker.java


注:本文中的beast.core.Description类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。