org.eclipse.xtext.xbase.lib.util.ToStringBuilder.getAllDeclaredFields()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(102)

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

ToStringBuilder.getAllDeclaredFields介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.lib

/**
 * Adds all fields declared in the object's class and its superclasses to the output.
 * @return this
 */
@GwtIncompatible("Class.getDeclaredFields")
public ToStringBuilder addAllFields() {
  List<Field> fields = getAllDeclaredFields(instance.getClass());
  for(Field field : fields) {
    addField(field);
  }
  return this;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.lib

/**
 * @param fieldName the name of the field to add to the output using reflection
 * @return this
 */
@GwtIncompatible("Class.getDeclaredField(String)")
public ToStringBuilder addField(final String fieldName) {
  List<Field> fields = getAllDeclaredFields(instance.getClass());
  for(Field field : fields) {
    if(fieldName.equals(field.getName())) {
      addField(field);
      break;
    }
  }
  return this;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.xtext.xbase.lib

/**
 * Adds all fields declared in the object's class and its superclasses to the output.
 * @return this
 */
@GwtIncompatible("Class.getDeclaredFields")
public ToStringBuilder addAllFields() {
 Class<?> _class = this.instance.getClass();
 ArrayList<Field> _allDeclaredFields = this.getAllDeclaredFields(_class);
 final Procedure1<Field> _function = new Procedure1<Field>() {
  @Override
  public void apply(final Field it) {
   ToStringBuilder.this.addField(it);
  }
 };
 IterableExtensions.<Field>forEach(_allDeclaredFields, _function);
 return this;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.xtext.xbase.lib

/**
 * @param fieldName the name of the field to add to the output using reflection
 * @return this
 */
@GwtIncompatible("Class.getDeclaredField(String)")
public ToStringBuilder addField(final String fieldName) {
 Class<?> _class = this.instance.getClass();
 ArrayList<Field> _allDeclaredFields = this.getAllDeclaredFields(_class);
 final Function1<Field, Boolean> _function = new Function1<Field, Boolean>() {
  @Override
  public Boolean apply(final Field it) {
   String _name = it.getName();
   return Boolean.valueOf(Objects.equal(_name, fieldName));
  }
 };
 Field _findFirst = IterableExtensions.<Field>findFirst(_allDeclaredFields, _function);
 return this.addField(_findFirst);
}

相关文章