com.manydesigns.elements.annotations.Label.value()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中com.manydesigns.elements.annotations.Label.value()方法的一些代码示例,展示了Label.value()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.value()方法的具体详情如下:
包路径:com.manydesigns.elements.annotations.Label
类名称:Label
方法名:value

Label.value介绍

暂无

代码示例

代码示例来源:origin: ManyDesigns/Portofino

public static String getLabel(PropertyAccessor accessor, TextProvider textProvider) {
  String label;
  if (accessor.isAnnotationPresent(LabelI18N.class)) {
    String text = accessor.getAnnotation(LabelI18N.class).value();
    logger.debug("LabelI18N annotation present with value: {}", text);
    label = textProvider.getText(text);
  } else if (accessor.isAnnotationPresent(Label.class)) {
    String text = accessor.getAnnotation(Label.class).value();
    logger.debug("Label annotation present with value: {}", text);
    label = textProvider.getText(text);
  } else {
    label = Util.guessToWords(accessor.getName());
    logger.debug("Setting label from property name: {}", label);
  }
  return label;
}

代码示例来源:origin: com.manydesigns/elements

public static String getLabel(PropertyAccessor accessor, TextProvider textProvider) {
  String label;
  if (accessor.isAnnotationPresent(LabelI18N.class)) {
    String text = accessor.getAnnotation(LabelI18N.class).value();
    logger.debug("LabelI18N annotation present with value: {}", text);
    label = textProvider.getText(text);
  } else if (accessor.isAnnotationPresent(Label.class)) {
    String text = accessor.getAnnotation(Label.class).value();
    logger.debug("Label annotation present with value: {}", text);
    label = textProvider.getText(text);
  } else {
    label = Util.guessToWords(accessor.getName());
    logger.debug("Setting label from property name: {}", label);
  }
  return label;
}

代码示例来源:origin: com.manydesigns/portofino-crud

protected void setupPropertyEdits() {
  if(classAccessor == null) {
    return;
  }
  PropertyAccessor[] propertyAccessors = classAccessor.getProperties();
  propertyEdits = new CrudPropertyEdit[propertyAccessors.length];
  for (int i = 0; i < propertyAccessors.length; i++) {
    CrudPropertyEdit edit = new CrudPropertyEdit();
    PropertyAccessor propertyAccessor = propertyAccessors[i];
    edit.name = propertyAccessor.getName();
    com.manydesigns.elements.annotations.Label labelAnn =
        propertyAccessor.getAnnotation(com.manydesigns.elements.annotations.Label.class);
    edit.label = labelAnn != null ? labelAnn.value() : null;
    Enabled enabledAnn = propertyAccessor.getAnnotation(Enabled.class);
    edit.enabled = enabledAnn != null && enabledAnn.value();
    InSummary inSummaryAnn = propertyAccessor.getAnnotation(InSummary.class);
    edit.inSummary = inSummaryAnn != null && inSummaryAnn.value();
    Insertable insertableAnn = propertyAccessor.getAnnotation(Insertable.class);
    edit.insertable = insertableAnn != null && insertableAnn.value();
    Updatable updatableAnn = propertyAccessor.getAnnotation(Updatable.class);
    edit.updatable = updatableAnn != null && updatableAnn.value();
    Searchable searchableAnn = propertyAccessor.getAnnotation(Searchable.class);
    edit.searchable = searchableAnn != null && searchableAnn.value();
    propertyEdits[i] = edit;
  }
}

相关文章