org.jgroups.util.Util.attributeNameToMethodName()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(175)

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

Util.attributeNameToMethodName介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

else {
  String field_name=Util.methodNameToAttributeName(method.getName());
  method_name=Util.attributeNameToMethodName(field_name);

代码示例来源:origin: wildfly/wildfly

/** Finds an accessor for an attribute. Tries to find setAttrName(), attrName() methods. If not
 * found, tries to use reflection to set the value of attr_name. If still not found, creates a NullAccessor. */
public static Accessor findSetter(Object target, String attr_name) {
  final String name=Util.attributeNameToMethodName(attr_name);
  final String fluent_name=toLowerCase(name);
  Class<?> clazz=target.getClass();
  Class<?> field_type=null;
  Field field=Util.getField(clazz, attr_name);
  field_type=field != null? field.getType() : null;
  String setter_name="set" + name;
  if(field_type != null) {
    Method method=Util.findMethod(target, Arrays.asList(fluent_name, setter_name), field_type);
    if(method != null && isSetMethod(method))
      return new MethodAccessor(method, target);
  }
  // Find all methods but don't include methods from Object class
  List<Method> methods=new ArrayList<>(Arrays.asList(clazz.getMethods()));
  methods.removeAll(OBJECT_METHODS);
  for(Method method: methods) {
    String method_name=method.getName();
    if((method_name.equals(name) || method_name.equals(fluent_name) || method_name.equals(setter_name)) && isSetMethod(method))
      return new MethodAccessor(method, target);
  }
  // Find a field last_name
  if(field != null)
    return new FieldAccessor(field, target);
  return null;
}

代码示例来源:origin: wildfly/wildfly

/** Finds an accessor for an attribute. Tries to find getAttrName(), isAttrName(), attrName() methods. If not
 * found, tries to use reflection to get the value of attr_name. If still not found, creates a NullAccessor. */
protected static Accessor findGetter(Object target, String attr_name) {
  final String name=Util.attributeNameToMethodName(attr_name);
  Class<?> clazz=target.getClass();
  Method   method=Util.findMethod(target, Arrays.asList("get" + name, "is" + name, toLowerCase(name)));
  if(method != null && (isGetMethod(method) || isIsMethod(method)))
    return new MethodAccessor(method, target);
   // 4. Find a field last_name
  Field field=Util.getField(clazz, attr_name);
  if(field != null)
    return new FieldAccessor(field, target);
  return new NoopAccessor();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/** Finds an accessor for an attribute. Tries to find setAttrName(), attrName() methods. If not
 * found, tries to use reflection to set the value of attr_name. If still not found, creates a NullAccessor. */
public static Accessor findSetter(Object target, String attr_name) {
  final String name=Util.attributeNameToMethodName(attr_name);
  final String fluent_name=toLowerCase(name);
  Class<?> clazz=target.getClass();
  Class<?> field_type=null;
  Field field=Util.getField(clazz, attr_name);
  field_type=field != null? field.getType() : null;
  String setter_name="set" + name;
  if(field_type != null) {
    Method method=Util.findMethod(target, Arrays.asList(fluent_name, setter_name), field_type);
    if(method != null && isSetMethod(method))
      return new MethodAccessor(method, target);
  }
  // Find all methods but don't include methods from Object class
  List<Method> methods=new ArrayList<>(Arrays.asList(clazz.getMethods()));
  methods.removeAll(OBJECT_METHODS);
  for(Method method: methods) {
    String method_name=method.getName();
    if((method_name.equals(name) || method_name.equals(fluent_name) || method_name.equals(setter_name)) && isSetMethod(method))
      return new MethodAccessor(method, target);
  }
  // Find a field last_name
  if(field != null)
    return new FieldAccessor(field, target);
  return null;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

else {
  String field_name=Util.methodNameToAttributeName(method.getName());
  method_name=Util.attributeNameToMethodName(field_name);

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/** Finds an accessor for an attribute. Tries to find getAttrName(), isAttrName(), attrName() methods. If not
 * found, tries to use reflection to get the value of attr_name. If still not found, creates a NullAccessor. */
protected static Accessor findGetter(Object target, String attr_name) {
  final String name=Util.attributeNameToMethodName(attr_name);
  Class<?> clazz=target.getClass();
  Method   method=Util.findMethod(target, Arrays.asList("get" + name, "is" + name, toLowerCase(name)));
  if(method != null && (isGetMethod(method) || isIsMethod(method)))
    return new MethodAccessor(method, target);
   // 4. Find a field last_name
  Field field=Util.getField(clazz, attr_name);
  if(field != null)
    return new FieldAccessor(field, target);
  return new NoopAccessor();
}

相关文章

Util类方法