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


Java Description类代码示例

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


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

示例1: getDescription

import oms3.annotations.Description; //导入依赖的package包/类
/** Get the Component Description
     *
     * @param comp the component class
     * @param loc the locale
     * @return the localized description
     */
    public static String getDescription(Class<?> comp, Locale loc) {
        Description descr = (Description) comp.getAnnotation(Description.class);
        if (descr != null) {
            String lang = loc.getLanguage();
            Method[] m = descr.getClass().getMethods();
            for (Method method : m) {
//                System.out.println(method);
                if (method.getName().equals(lang)) {
                    try {
                        String d = (String) method.invoke(descr, (Object[]) null);
                        if (d != null && !d.isEmpty()) {
                            return d;
                        }
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
            }
            return descr.value();
        }
        return null;
    }
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:29,代码来源:Components.java

示例2: collectParameters

import oms3.annotations.Description; //导入依赖的package包/类
private static void collectParameters( StringBuilder sbTmp, Collection<Access> accessList ) throws Exception {
    for( Access access : accessList ) {
        Field field = access.getField();
        String fieldName = field.getName();
        Description descriptionAnnot = field.getAnnotation(Description.class);

        if (fieldName.equals("pm")) {
            // ignore progress monitor
            continue;
        }
        String fieldDescription = " - ";
        if (descriptionAnnot != null) {
            fieldDescription = AnnotationUtilities.getLocalizedDescription(descriptionAnnot);
            if (fieldDescription == null) {
                fieldDescription = " - ";
            }

            Unit unitAnn = field.getAnnotation(Unit.class);
            if (unitAnn != null) {
                fieldDescription = fieldDescription + " [" + unitAnn.value() + "]";
            }
        }

        sbTmp.append("<tr>").append(NEWLINE);
        sbTmp.append("<td width=\"40%\"> <b>").append(fieldName).append("</b> </td><td width=\"60%\"> ");
        sbTmp.append(fieldDescription).append(" </td>").append(NEWLINE);
        sbTmp.append("</tr>").append(NEWLINE);
    }
}
 
开发者ID:moovida,项目名称:STAGE,代码行数:30,代码来源:SpatialToolboxUtils.java

示例3: collectParameters

import oms3.annotations.Description; //导入依赖的package包/类
public static void collectParameters( StringBuilder sbTmp, Collection<Access> accessList, String pre ) throws Exception {
    for( Access access : accessList ) {
        Field field = access.getField();
        String fieldName = field.getName();
        Description descriptionAnnot = field.getAnnotation(Description.class);

        if (fieldName.equals("pm") || fieldName.equals("gf") || fieldName.equals("doProcess") || fieldName.equals("doReset")) {
            // ignore progress monitor
            continue;
        }
        String fieldDescription = " - ";
        if (descriptionAnnot != null) {
            fieldDescription = descriptionAnnot.value();
            if (fieldDescription == null) {
                fieldDescription = " - ";
            }

            Unit unitAnn = field.getAnnotation(Unit.class);
            if (unitAnn != null) {
                fieldDescription = fieldDescription + " [" + unitAnn.value() + "]";
            }
        }

        sbTmp.append(pre).append(fieldName).append(": ");
        sbTmp.append(fieldDescription).append("\n");
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:28,代码来源:ModelsSupporter.java

示例4: addInput

import oms3.annotations.Description; //导入依赖的package包/类
private void addInput( Access access, ModuleDescription module ) throws Exception {
    Field field = access.getField();
    Description descriptionAnn = field.getAnnotation(Description.class);
    String descriptionStr = "No description available";
    if (descriptionAnn != null) {
        descriptionStr = AnnotationUtilities.getLocalizedDescription(descriptionAnn);
    }

    StringBuilder sb = new StringBuilder();
    sb.append(descriptionStr);

    Unit unitAnn = field.getAnnotation(Unit.class);
    if (unitAnn != null) {
        sb.append(" [");
        sb.append(unitAnn.value());
        sb.append("]");
    }
    Range rangeAnn = field.getAnnotation(Range.class);
    if (rangeAnn != null) {
        sb.append(" [");
        sb.append(rangeAnn.min());
        sb.append(" ,");
        sb.append(rangeAnn.max());
        sb.append("]");
    }
    descriptionStr = sb.toString();

    String fieldName = field.getName();
    Class< ? > fieldClass = field.getType();
    Object fieldValue = access.getFieldValue();

    String defaultValue = ""; //$NON-NLS-1$
    if (fieldValue != null) {
        defaultValue = fieldValue.toString();
    }

    UI uiHintAnn = field.getAnnotation(UI.class);
    String uiHint = null;
    if (uiHintAnn != null) {
        uiHint = uiHintAnn.value();
    }

    module.addInput(fieldName, fieldClass.getCanonicalName(), descriptionStr, defaultValue, uiHint);
}
 
开发者ID:moovida,项目名称:STAGE,代码行数:45,代码来源:StageModulesManager.java

示例5: addOutput

import oms3.annotations.Description; //导入依赖的package包/类
private void addOutput( Access access, ModuleDescription module ) throws Exception {
    Field field = access.getField();
    Description descriptionAnn = field.getAnnotation(Description.class);
    String descriptionStr = "No description available";
    if (descriptionAnn != null) {
        descriptionStr = AnnotationUtilities.getLocalizedDescription(descriptionAnn);
    }
    StringBuilder sb = new StringBuilder();
    sb.append(descriptionStr);

    Unit unitAnn = field.getAnnotation(Unit.class);
    if (unitAnn != null) {
        sb.append(" [");
        sb.append(unitAnn.value());
        sb.append("]");
    }
    Range rangeAnn = field.getAnnotation(Range.class);
    if (rangeAnn != null) {
        sb.append(" [");
        sb.append(rangeAnn.min());
        sb.append(" ,");
        sb.append(rangeAnn.max());
        sb.append("]");
    }
    descriptionStr = sb.toString();

    String fieldName = field.getName();
    Class< ? > fieldClass = field.getType();
    Object fieldValue = access.getFieldValue();

    String defaultValue = ""; //$NON-NLS-1$
    if (fieldValue != null) {
        defaultValue = fieldValue.toString();
    }

    UI uiHintAnn = field.getAnnotation(UI.class);
    String uiHint = null;
    if (uiHintAnn != null) {
        uiHint = uiHintAnn.value();
    }

    module.addOutput(fieldName, fieldClass.getCanonicalName(), descriptionStr, defaultValue, uiHint);
}
 
开发者ID:moovida,项目名称:STAGE,代码行数:44,代码来源:StageModulesManager.java

示例6: addInput

import oms3.annotations.Description; //导入依赖的package包/类
private void addInput( Access access, ModuleDescription module ) throws Exception {
    Field field = access.getField();
    Description descriptionAnn = field.getAnnotation(Description.class);
    String descriptionStr = "No description available";
    if (descriptionAnn != null) {
        descriptionStr = AnnotationUtilities.getLocalizedDescription(descriptionAnn);
    }

    StringBuilder sb = new StringBuilder();
    sb.append(descriptionStr);

    Unit unitAnn = field.getAnnotation(Unit.class);
    if (unitAnn != null) {
        sb.append(" [");
        sb.append(unitAnn.value());
        sb.append("]");
    }
    Range rangeAnn = field.getAnnotation(Range.class);
    if (rangeAnn != null) {
        sb.append(" [");
        sb.append(rangeAnn.min());
        sb.append(" ,");
        sb.append(rangeAnn.max());
        sb.append("]");
    }
    descriptionStr = sb.toString();

    String fieldName = field.getName();
    if (doIgnore(fieldName)) {
        return;
    }
    Class< ? > fieldClass = field.getType();
    Object fieldValue = access.getFieldValue();

    String defaultValue = ""; //$NON-NLS-1$
    if (fieldValue != null) {
        defaultValue = fieldValue.toString();
    }

    UI uiHintAnn = field.getAnnotation(UI.class);
    String uiHint = null;
    if (uiHintAnn != null) {
        uiHint = uiHintAnn.value();
    }

    module.addInput(fieldName, fieldClass.getCanonicalName(), descriptionStr, defaultValue, uiHint);
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:48,代码来源:HortonmachineModulesManager.java

示例7: addOutput

import oms3.annotations.Description; //导入依赖的package包/类
private void addOutput( Access access, ModuleDescription module ) throws Exception {
    Field field = access.getField();
    Description descriptionAnn = field.getAnnotation(Description.class);
    String descriptionStr = "No description available";
    if (descriptionAnn != null) {
        descriptionStr = AnnotationUtilities.getLocalizedDescription(descriptionAnn);
    }
    StringBuilder sb = new StringBuilder();
    sb.append(descriptionStr);

    Unit unitAnn = field.getAnnotation(Unit.class);
    if (unitAnn != null) {
        sb.append(" [");
        sb.append(unitAnn.value());
        sb.append("]");
    }
    Range rangeAnn = field.getAnnotation(Range.class);
    if (rangeAnn != null) {
        sb.append(" [");
        sb.append(rangeAnn.min());
        sb.append(" ,");
        sb.append(rangeAnn.max());
        sb.append("]");
    }
    descriptionStr = sb.toString();

    String fieldName = field.getName();
    if (doIgnore(fieldName)) {
        return;
    }
    Class< ? > fieldClass = field.getType();
    Object fieldValue = access.getFieldValue();

    String defaultValue = ""; //$NON-NLS-1$
    if (fieldValue != null) {
        defaultValue = fieldValue.toString();
    }

    UI uiHintAnn = field.getAnnotation(UI.class);
    String uiHint = null;
    if (uiHintAnn != null) {
        uiHint = uiHintAnn.value();
    }

    module.addOutput(fieldName, fieldClass.getCanonicalName(), descriptionStr, defaultValue, uiHint);
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:47,代码来源:HortonmachineModulesManager.java

示例8: getLocalizedDescription

import oms3.annotations.Description; //导入依赖的package包/类
/**
 * Gets the localized description of the {@link Description}.
 * 
 * @param description the {@link Description} annotation.
 * @return the description string or " - ".
 * @throws Exception
 */
public static String getLocalizedDescription( Description description ) throws Exception {
    // try to get the language
    Class< ? > annotationclass = Description.class;
    return getLocalizedString(description, annotationclass);
}
 
开发者ID:moovida,项目名称:STAGE,代码行数:13,代码来源:AnnotationUtilities.java


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