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

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

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

Util.methodNameToAttributeName介绍

[英]Converts a method name to an attribute name, e.g. getFooBar() --> foo_bar, isFlag --> flag.
[中]将方法名称转换为属性名称,例如getFooBar()-->foo_bar、isFlag-->flag。

代码示例

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

@Override
public String getName() {
  String name = super.getName();
  return (name != null) ? name : Util.methodNameToAttributeName(this.accessible.getName());
}

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

public static String getPropertyName(Method method) throws IllegalArgumentException {
  if (method == null) {
    throw new IllegalArgumentException("Cannot get property name: field is null") ;
  }
  Property annotation=method.getAnnotation(Property.class);
  if (annotation == null) {
    throw new IllegalArgumentException("Cannot get property name for method " + 
        method.getName() + " which is not annotated with @Property") ;
  }            
  String propertyName=!annotation.name().isEmpty()? annotation.name() : method.getName();
  propertyName=Util.methodNameToAttributeName(propertyName);
  return propertyName ;
}

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

name = Util.methodNameToAttributeName(method.getName());

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

method_name=method_name.trim();
else {
  String field_name=Util.methodNameToAttributeName(method.getName());
  method_name=Util.attributeNameToMethodName(field_name);
  try {
    Object value=method.invoke(obj);
    String attributeName=Util.methodNameToAttributeName(method_name);
    if(value instanceof Double)
      value=String.format("%.2f", (double)value);

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

if(annotation.name() != null)
  possible_names.add(annotation.name());
possible_names.add(Util.methodNameToAttributeName(methodName));
Field field=Util.findField(prot, possible_names);
if(field != null) {

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

if(annotation.name() != null)
  possible_names.add(annotation.name());
possible_names.add(Util.methodNameToAttributeName(methodName));
Field field=Util.findField(prot, possible_names);
if(field != null) {

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

final String name;
if (annotation.name().length() < 1) {
  name = Util.methodNameToAttributeName(method.getName());
} else {
  name = annotation.name();

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

else {
  attr_name=Util.methodNameToAttributeName(methodName);
  if(!atts.containsKey(attr_name)) {
  String type=is_setter? method.getParameterTypes()[0].getCanonicalName() : method.getReturnType().getCanonicalName();
  MBeanAttributeInfo info=new MBeanAttributeInfo(attr_name, type, descr, true, writable, methodName.startsWith("is"));
  AttributeEntry entry=new AttributeEntry(Util.methodNameToAttributeName(methodName), info);
  if(is_setter)
    entry.setter(new MethodAccessor(method, instance));

代码示例来源:origin: org.jboss.eap/wildfly-clustering-jgroups-extension

@Override
public String getName() {
  String name = super.getName();
  return (name != null) ? name : Util.methodNameToAttributeName(this.accessible.getName());
}

代码示例来源:origin: org.infinispan.server/infinispan-server-jgroups

@Override
public String getName() {
  String name = super.getName();
  return (name != null) ? name : Util.methodNameToAttributeName(this.accessible.getName());
}

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

public static String getPropertyName(Method method) throws IllegalArgumentException {
  if (method == null) {
    throw new IllegalArgumentException("Cannot get property name: field is null") ;
  }
  Property annotation=method.getAnnotation(Property.class);
  if (annotation == null) {
    throw new IllegalArgumentException("Cannot get property name for method " + 
        method.getName() + " which is not annotated with @Property") ;
  }            
  String propertyName=!annotation.name().isEmpty()? annotation.name() : method.getName();
  propertyName=Util.methodNameToAttributeName(propertyName);
  return propertyName ;
}

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

name = Util.methodNameToAttributeName(method.getName());

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

method_name=method_name.trim();
else {
  String field_name=Util.methodNameToAttributeName(method.getName());
  method_name=Util.attributeNameToMethodName(field_name);
  try {
    Object value=method.invoke(obj);
    String attributeName=Util.methodNameToAttributeName(method_name);
    if(value instanceof Double)
      value=String.format("%.2f", (double)value);

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

if(annotation.name() != null)
  possible_names.add(annotation.name());
possible_names.add(Util.methodNameToAttributeName(methodName));
Field field=Util.findField(prot, possible_names);
if(field != null) {

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

if(annotation.name() != null)
  possible_names.add(annotation.name());
possible_names.add(Util.methodNameToAttributeName(methodName));
Field field=Util.findField(prot, possible_names);
if(field != null) {

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

final String name;
if (annotation.name().length() < 1) {
  name = Util.methodNameToAttributeName(method.getName());
} else {
  name = annotation.name();

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

else {
  attr_name=Util.methodNameToAttributeName(methodName);
  if(!atts.containsKey(attr_name)) {
  String type=is_setter? method.getParameterTypes()[0].getCanonicalName() : method.getReturnType().getCanonicalName();
  MBeanAttributeInfo info=new MBeanAttributeInfo(attr_name, type, descr, true, writable, methodName.startsWith("is"));
  AttributeEntry entry=new AttributeEntry(Util.methodNameToAttributeName(methodName), info);
  if(is_setter)
    entry.setter(new MethodAccessor(method, instance));

相关文章

Util类方法