Java Field from Class getProperField(Class objectClass)

Here you can find the source of getProperField(Class objectClass)

Description

get Proper Field

License

Apache License

Declaration

public static String getProperField(Class objectClass) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Field;

import java.net.SocketAddress;

public class Main {
    public static String getProperField(Class objectClass) {
        for (Field f : objectClass.getFields()) {
            if (f.getType() == SocketAddress.class) {
                return f.getName();
            }//from w w w.  j  av  a2 s .  c  om
        }

        return "N/A";
    }
}

Related

  1. getDeclaredField(final Class javaClass, final String fieldName, final boolean shouldSetAccessible)
  2. getDeclaredFields(final Class clazz)
  3. getField(Class type, String name)
  4. getField(final Class javaClass, final String fieldName, final boolean shouldSetAccessible)
  5. getJsonValueFieldName(String className)
  6. setPrivateField(String fieldName, Class containingClass, Object target, Object value)