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

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

本文整理了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

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

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

  1. public static String getPropertyName(Method method) throws IllegalArgumentException {
  2. if (method == null) {
  3. throw new IllegalArgumentException("Cannot get property name: field is null") ;
  4. }
  5. Property annotation=method.getAnnotation(Property.class);
  6. if (annotation == null) {
  7. throw new IllegalArgumentException("Cannot get property name for method " +
  8. method.getName() + " which is not annotated with @Property") ;
  9. }
  10. String propertyName=!annotation.name().isEmpty()? annotation.name() : method.getName();
  11. propertyName=Util.methodNameToAttributeName(propertyName);
  12. return propertyName ;
  13. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. public static String getPropertyName(Method method) throws IllegalArgumentException {
  2. if (method == null) {
  3. throw new IllegalArgumentException("Cannot get property name: field is null") ;
  4. }
  5. Property annotation=method.getAnnotation(Property.class);
  6. if (annotation == null) {
  7. throw new IllegalArgumentException("Cannot get property name for method " +
  8. method.getName() + " which is not annotated with @Property") ;
  9. }
  10. String propertyName=!annotation.name().isEmpty()? annotation.name() : method.getName();
  11. propertyName=Util.methodNameToAttributeName(propertyName);
  12. return propertyName ;
  13. }

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

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

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

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

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

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

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

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

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

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

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

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

相关文章

Util类方法