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

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

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

Util.getAllDeclaredFieldsWithAnnotations介绍

暂无

代码示例

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

public static Field[] getAllDeclaredFields(final Class clazz) {
  return getAllDeclaredFieldsWithAnnotations(clazz);
}

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

/**
 * Makes sure that all fields annotated with @LocalAddress is (1) an InetAddress and (2) a valid address on any
 * local network interface
 * @param protocols
 * @throws Exception
 */
public static void ensureValidBindAddresses(List<Protocol> protocols) throws Exception {
  for(Protocol protocol : protocols) {
    String protocolName=protocol.getName();
    //traverse class hierarchy and find all annotated fields and add them to the list if annotated
    Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), LocalAddress.class);
    for(int i=0; i < fields.length; i++) {
      Object val=getValueFromProtocol(protocol, fields[i]);
      if(val == null)
        continue;
      if(!(val instanceof InetAddress))
        throw new Exception("field " + protocolName + "." + fields[i].getName() + " is not an InetAddress");
      Util.checkIfValidAddress((InetAddress)val, protocolName);
    }
  }
}

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

Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), Property.class);
for(int j=0; j < fields.length; j++) {

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

Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), Property.class);
for(int j=0; j < fields.length; j++) {
  String propertyName=PropertyHelper.getPropertyName(fields[j], properties);

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

public static Field[] getAllDeclaredFields(final Class clazz) {
  return getAllDeclaredFieldsWithAnnotations(clazz);
}

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

/**
 * Makes sure that all fields annotated with @LocalAddress is (1) an InetAddress and (2) a valid address on any
 * local network interface
 * @param protocols
 * @throws Exception
 */
public static void ensureValidBindAddresses(List<Protocol> protocols) throws Exception {
  for(Protocol protocol : protocols) {
    String protocolName=protocol.getName();
    //traverse class hierarchy and find all annotated fields and add them to the list if annotated
    Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), LocalAddress.class);
    for(int i=0; i < fields.length; i++) {
      Object val=getValueFromProtocol(protocol, fields[i]);
      if(val == null)
        continue;
      if(!(val instanceof InetAddress))
        throw new Exception("field " + protocolName + "." + fields[i].getName() + " is not an InetAddress");
      Util.checkIfValidAddress((InetAddress)val, protocolName);
    }
  }
}

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

Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), Property.class);
for(int j=0; j < fields.length; j++) {

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

Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), Property.class);
for(int j=0; j < fields.length; j++) {
  String propertyName=PropertyHelper.getPropertyName(fields[j], properties);

相关文章

Util类方法