Obtains the property type of the given field of {@link #clazz}
960224
public PropertyType getPropertyType(String field) {
        if(propertyTypes==null)
            propertyTypes = buildPropertyTypes(clazz);
        return propertyTypes.get(field);
    }
210654
public String getTypeName(Class<?> clazz) {
		Type type = typeAnnotations.get(clazz);

		if (type != null) {
			return type.value();
		}
		return null;
	}
679914
List<Field> getFields(Class<?> clazz) {
        List<Field> result = new ArrayList<>();
        Set<String> fieldNames = new HashSet<>();
        Class<?> searchType = clazz;
        while (!Object.class.equals(searchType) && searchType != null) {
            Field[] fields = searchType.getDeclaredFields();
            for (Field field : fields) {
                if (!fieldNames.contains(field.getName())) {
                    fieldNames.add(field.getName());
                    makeAccessible(field);
                    result.add(field);
                }
            }
            searchType = searchType.getSuperclass();
        }
        return result;
    }
1401
public static Properties getFieldsAsProperties(Object obj, Class<?>[] clazzes) throws Exception {
        Properties props = new Properties();
        for (Field field : obj.getClass().getDeclaredFields()) {
            if (Modifier.isStatic(field.getModifiers()))
                continue;
            field.setAccessible(true);
            Class<?> type = field.getType();
            if (clazzes == null || contains(type, clazzes)) {
                Object val = field.get(obj);
                if (val != null)
                    props.put(field.getName(), val.toString());

            }
        }

        return props;
    }
331382
protected TypeReference<?> getBeanPropertyType(Class<?> clazz,
			String propertyName, TypeReference<?> originalType) {
		TypeReference<?> propertyDestinationType = null;
		if (beanDestinationPropertyTypeProvider != null) {
			propertyDestinationType = beanDestinationPropertyTypeProvider
					.getPropertyType(clazz, propertyName, originalType);
		}
		if (propertyDestinationType == null) {
			propertyDestinationType = originalType;
		}
		return propertyDestinationType;
	}
917963
public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, final String fieldName, boolean ignoreCase) throws BeanException {
		final Map<String, PropertyDescriptor> map = getPropertyDescriptorMap(clazz, ignoreCase);
		return (null == map) ? null : map.get(fieldName);
	}
208108
public static RuntimeFieldFactory<?> getFieldFactory(Class<?> clazz,
            IdStrategy strategy)
    {
        if (strategy.isDelegateRegistered(clazz))
            return DELEGATE;

        final RuntimeFieldFactory<?> inline = __inlineValues.get(clazz
                .getName());
        if (inline != null)
            return inline;

        if (Message.class.isAssignableFrom(clazz))
            return POJO;

        if (clazz.isEnum())
            return ENUM;

        // Of all the scalar (inline) fields, java.lang.Number is the only
        // abstract
        // super type, hence we can filter it here
        // Note that it has 10 built-in subtypes
        if (clazz.isArray() || Object.class == clazz || Number.class == clazz
                || Class.class == clazz || Enum.class == clazz
                || Throwable.class.isAssignableFrom(clazz))
        {
            return OBJECT;
        }
        
        if (strategy.isRegistered(clazz))
            return clazz.isInterface() ? POJO : POLYMORPHIC_POJO;
        
        if (Map.class.isAssignableFrom(clazz))
            return RuntimeMapFieldFactory.MAP;

        if (Collection.class.isAssignableFrom(clazz))
        {
            // repeated fields.
            return COLLECTION;
        }

        // Enums or boxed types of primitives do implement interfaces.
        // Although serializing polymorphic pojos declared as interfaces will be
        // a
        // little bit slower than before, this is more correct.
        //
        // In versions prior to 1.0.5, it would serialize a field declared as
        // java.lang.Serializable like a polymorphic pojo even though it
        // gets assigned enum/string/number types.
        //
        // If you have declared fields as serializable, it wont be compatible
        if (clazz.isInterface())
            return OBJECT;

        // checks delegated to POLYMORPHIC_POJO
        return POLYMORPHIC_POJO;
    }
699240
public static Class getFieldGenericType(Field field, int index) {
    	Type genericFieldType = field.getGenericType();
    	
    	if(genericFieldType instanceof ParameterizedType){
    	    ParameterizedType aType = (ParameterizedType) genericFieldType;
    	    Type[] fieldArgTypes = aType.getActualTypeArguments();
    	    if (index >= fieldArgTypes.length || index < 0) {
				throw new IllegalArgumentException("index "+ (index<0 ? " must > 0 " : " over total arguments"));
			}
    	    return (Class)fieldArgTypes[index];
    	}
    	return Object.class;
    }
16115
private void determineFieldType(Field field) {
        // Determine the class of data stored in the field
        Class<?> fieldType = field.getType();

        isCollection = Collection.class.isAssignableFrom(fieldType);

        valueClass=null;
        if (!isCollection) {
            // It's not a list so assume its single valued - so just take the field type
            valueClass = fieldType;
        } else {
            determineCollectionClass(fieldType);
            // It's multi-valued - so we need to look at the signature in
            // the class file to find the generic type - this is supported for class file
            // format 49 and greater which corresponds to java 5 and later.
            ParameterizedType paramType;
            try {
                paramType = (ParameterizedType)field.getGenericType();
            } catch (ClassCastException e) {
                throw new MetaDataException(String.format("Can't determine destination type for field %1$s in Entry class %2$s", 
                        field, field.getDeclaringClass()), e);
            }
            Type[] actualParamArguments = paramType.getActualTypeArguments();
            if (actualParamArguments.length == 1) {
                if (actualParamArguments[0] instanceof Class) {
                    valueClass = (Class<?>)actualParamArguments[0];                    
                } else {
                    if (actualParamArguments[0] instanceof GenericArrayType) {
                        // Deal with arrays
                        Type type=((GenericArrayType)actualParamArguments[0]).getGenericComponentType();
                        if (type instanceof Class) {
                            valueClass=Array.newInstance((Class<?>)type, 0).getClass();
                        } 
                    } 
                }
            } 
        }

        // Check we have been able to determine the value class
        if (valueClass==null) {
            throw new MetaDataException(String.format("Can't determine destination type for field %1$s in class %2$s", 
                    field, field.getDeclaringClass()));
        }
    }
81369
public static Type getDeclaredBeanType(Class<?> clazz) {
        Type[] actualTypeArguments = Reflections.getActualTypeArguments(clazz);
        if (actualTypeArguments.length == 1) {
            return actualTypeArguments[0];
        } else {
            return null;
        }
    }
1284809
public String retrieveTargetFieldName(final Field field){
		
		// this list contains the configuredClass with super classes
		List<Class<?>> classes = getAllsuperClasses(configuredClass);
		
		// in case of override only the last global configuration must be analyzed
		Global global = null; 
		// If configuredClass exists in XML configuration file
		for (Class<?> clazz : classes){
		  
		  if(!xml.isMapped(clazz))continue;

		  // only if global configuration is null will be searched global configuration on super classes
		  if(isNull(global)){
			  
			  global = xml.loadGlobals().get(clazz.getName());
			  if( !isNull(global) 
				  && !isPresent(global.getExcluded(), field.getName())
				  && (	isEmpty(global.getAttributes()) 
					 || isPresent(global.getAttributes(), new SimplyAttribute(field.getName()))
					 )
				 ){
				  // get the classes of the xmlField
				  List<Class<?>> globalClasses = toList(global.getClasses());
				  
				  // if mapped field hasn't targetClass in classes parameter
				  if(!globalClasses.isEmpty() && !globalClasses.contains(targetClass)) continue;
				  
				  // get value of xmlField
				  String value = global.getValue();
				  
				  // If the Value is empty, 
				  // then the name of the target field is equal to the configuredField name, 
				  // therefore we pass the default value we use to indicate equality
				  if(isNull(value)) value = DEFAULT_FIELD_VALUE;
				  
				  // loaded all variables, calculates and returns the correspondence
				  return getValue(Collections.<String>emptyList(), globalClasses, value, field.getName(), clazz, targetClass);
			  }
		  }
			  
		  // loads all configured attributes 
		  for(Attribute attribute :xml.loadAttributes().get(clazz.getName())){
				
			// verifies that exists the attribute written in XML in the configured Class
			if(isNull(fieldName(clazz,attribute.getName())))	
				Error.attributeAbsent(clazz, attribute);
				
			// if the field given in input isn't equal to xmlField continue with the cycle
			if(!attribute.getName().equals(field.getName())) continue;
				
			// get the classes of the xmlField
			List<Class<?>> attributeClasses = toList(attribute.getClasses());
				
			// if mapped field hasn't targetClass in classes parameter
			if(!attributeClasses.isEmpty() && !attributeClasses.contains(targetClass)) continue;
								
			// get the attributes names of xmlField
			List<String> attributes = new ArrayList<String>();
			if(attribute.getAttributes() != null)
				for (SimplyAttribute targetAttribute : attribute.getAttributes()) 
					attributes.add(targetAttribute.getName());
				
			// get value of xmlField
			String value = null;
			if(!isNull(attribute.getValue()))
				value = attribute.getValue().getName();
			
			// If the Value and Attributes parameters are empty, 
			// then the name of the target field is equal to the configuredField name, 
			// therefore we pass the default value we use to indicate equality
			if(isNull(value) && attributes.isEmpty()) value = DEFAULT_FIELD_VALUE;
				
			// loaded all variables, calculates and returns the correspondence
			return getValue(attributes, attributeClasses, value, field.getName(), clazz, targetClass);
		  }
	    }
		
		// if class is configured in xml the annotated configuration is not searched
		// if it has a configured superclass it's ignored, the priority is valid only for principal class
		if(xml.isInheritedMapped(configuredClass))return THE_FIELD_IS_NOT_CONFIGURED;
		
		// if the XML configuration doesn't exist, checks the annotation existence
		for (Class<?> clazz : classes){
			
			JGlobalMap jglobalMap = clazz.getAnnotation(JGlobalMap.class);
			
			//if the field configuration is defined in the global map
			if(  !isNull(jglobalMap)){
				if(!isPresent(jglobalMap.excluded(), field.getName())
						&& (    isEmpty(jglobalMap.attributes()) 
								|| isPresent(jglobalMap.attributes(), field.getName())
								)){
					
					// get the list of target classes
					List<Class<?>> globalClasses = toList(jglobalMap.classes());
					
					// if mapped field hasn't targetClass in classes parameter
					if(!globalClasses.isEmpty() && !globalClasses.contains(targetClass)) return THE_FIELD_IS_NOT_CONFIGURED;
					
					// get value of configuredField
					String value = jglobalMap.value();
					
					// loaded all variables, calculates and returns the correspondence
					return getValue(Collections.<String>emptyList(), globalClasses, value, field.getName(), configuredClass, targetClass);			
				}
				// If global mapping is defined on this level, global mapping of super classes is ignored.
				// This is necessary to apply configuration override.
				break;
			}
		}
			
		JMap jmap = field.getAnnotation(JMap.class);
		if(isNull(jmap)) return THE_FIELD_IS_NOT_CONFIGURED;
			
		// get the list of target classes
		List<Class<?>> targetClasses = toList(jmap.classes());
			
		// if mapped field hasn't targetClass in classes parameter
		if(!targetClasses.isEmpty() && !targetClasses.contains(targetClass)) return THE_FIELD_IS_NOT_CONFIGURED;
			
		// get the list of target attributes
		List<String> attributes = toList(jmap.attributes());
		
		// get value of configuredField
		String value = jmap.value();
			
		// loaded all variables, calculates and returns the correspondence
		return getValue(attributes, targetClasses, value, field.getName(), configuredClass, targetClass);
		
	}
1045848
public static Class<?> getPropertyType(Class<?> clazz, String propertyName) {
        if (clazz == null || !StringUtils.hasText(propertyName)) {
            return null;
        }

        try {
            PropertyDescriptor desc=BeanUtils.getPropertyDescriptor(clazz, propertyName);
            if (desc != null) {
                return desc.getPropertyType();
            }
            return null;
        }
        catch (Exception e) {
            // if there are any errors in instantiating just return null for the moment
            return null;
        }
    }
536623
public static Class<?> getGenericFieldType(Field field) {
        ParameterizedType stringListType = (ParameterizedType) field.getGenericType();
        Class<?> clazz = (Class<?>) stringListType.getActualTypeArguments()[0];
        return clazz;
	}
1197892
@SuppressWarnings("unchecked")
	@Override
	public <T> T getProperty(Object key, Class<T> clazz) {
	    return (T)getProperty(key);
	}
1086852
public static String getMapFieldType(Field field) {
        String k = getMapFieldKeyType(field);
        String v = getMapFieldValueType(field);
        return "java.util.Map<" + k + ", " + v + ">";
    }
528893
public static Field getField(Class clazz, String fieldName)
    {
        try
        {
            return clazz.getField(fieldName);
        }
        catch (Exception ignored)
        {}
        return null;
    }
999115
public Class<?> getArrayType(Class<?> clazz) {

        if (clazz.isArray()) {
            return getArrayType(clazz.getComponentType());
        }

        return clazz;
    }