Return the specified {@code propValue} got by the specified method
{@code propSetMethod} in the specified {@code entity}.

@param entity
MapEntity is not supported
@param propGetMethod

@return
969213
@SuppressWarnings("unchecked")
    public static <T> T getPropValue(final Object entity, final Method propGetMethod) {
        try {
            return (T) propGetMethod.invoke(entity);
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            throw N.toRuntimeException(e);
        }
    }
625971
private function createGetter(Entity $entity, $property, $annotation)
    {
        if ($annotation->getter === null) {
            $getter = new PropertyGetter($entity, $property);
        } else {
            if ($annotation->getter === true) {
                $methodName = 'get' . ucfirst($property);
            } else {
                $methodName = $annotation->getter;
            }
            $getter = new MethodGetter($entity, $methodName);
        }

        return $getter;
    }
893674
public static void fill(Object entity) {
        final Class<?> entityClass = entity.getClass();

        if (N.isEntity(entityClass) == false) {
            throw new IllegalArgumentException(entityClass.getCanonicalName() + " is not a valid entity class with property getter/setter method");
        }

        Type<Object> type = null;
        Class<?> parameterClass = null;
        Object propValue = null;

        for (Method method : ClassUtil.getPropSetMethodList(entityClass).values()) {
            parameterClass = method.getParameterTypes()[0];
            type = N.typeOf(parameterClass);

            if (String.class.equals(parameterClass)) {
                propValue = N.uuid().substring(0, 16);
            } else if (boolean.class.equals(parameterClass) || Boolean.class.equals(parameterClass)) {
                propValue = RAND.nextInt() % 2 == 0 ? false : true;
            } else if (char.class.equals(parameterClass) || Character.class.equals(parameterClass)) {
                propValue = (char) ('a' + RAND.nextInt() % 26);
            } else if (int.class.equals(parameterClass) || Integer.class.equals(parameterClass)) {
                propValue = RAND.nextInt();
            } else if (long.class.equals(parameterClass) || Long.class.equals(parameterClass)) {
                propValue = RAND.nextLong();
            } else if (float.class.equals(parameterClass) || Float.class.equals(parameterClass)) {
                propValue = RAND.nextFloat();
            } else if (double.class.equals(parameterClass) || Double.class.equals(parameterClass)) {
                propValue = RAND.nextDouble();
            } else if (byte.class.equals(parameterClass) || Byte.class.equals(parameterClass)) {
                propValue = Integer.valueOf(RAND.nextInt()).byteValue();
            } else if (short.class.equals(parameterClass) || Short.class.equals(parameterClass)) {
                propValue = Integer.valueOf(RAND.nextInt()).shortValue();
            } else if (Number.class.isAssignableFrom(parameterClass)) {
                propValue = type.valueOf(String.valueOf(RAND.nextInt()));
            } else if (java.util.Date.class.isAssignableFrom(parameterClass) || Calendar.class.isAssignableFrom(parameterClass)) {
                propValue = type.valueOf(String.valueOf(System.currentTimeMillis()));
            } else if (N.isEntity(parameterClass)) {
                propValue = fill(parameterClass);
            } else {
                propValue = type.defaultValue();
            }

            ClassUtil.setPropValue(entity, method, propValue);
        }
    }
1256333
public static Object getProperty(Object obj, String prop, Object defaultValue) {

	// first try field
	Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop, null);
	if (!ArrayUtil.isEmpty(fields)) {
	    try {
		return fields[0].get(obj);
	    }
	    catch (Throwable t) {
		ExceptionUtil.rethrowIfNecessary(t);
	    }
	}

	// then getter
	try {
	    char first = prop.charAt(0);
	    if (first >= '0' && first <= '9') return defaultValue;
	    return getGetter(obj.getClass(), prop).invoke(obj);
	}
	catch (Throwable e1) {
	    ExceptionUtil.rethrowIfNecessary(e1);
	    return defaultValue;
	}
    }
159194
@RequestMapping(value = "{entityType}/{id}", method = RequestMethod.GET)
    public Resources<Resource<Property<?>>> getProperties(@PathVariable ProjectEntityType entityType, @PathVariable ID id) {
        ProjectEntity entity = getEntity(entityType, id);
        List<Property<?>> properties = propertyService.getProperties(entity);
        List<Resource<Property<?>>> resources = new ArrayList<>();
        for (Property<?> property : properties) {
            Resource<Property<?>> resource = Resource.of(
                    property,
                    uri(on(getClass()).getPropertyValue(entity.getProjectEntityType(), entity.getId(), property.getType().getClass().getName()))
            );
            // Update
            resource = resource.with(
                    Link.UPDATE,
                    uri(on(getClass()).getPropertyEditionForm(entity.getProjectEntityType(), entity.getId(), property.getType().getClass().getName())));
            // OK
            resources.add(resource);
        }
        return Resources.of(
                resources,
                uri(on(getClass()).getProperties(entityType, id))
        );
    }
423838
public DBObject toDBObject(final Object entity) {
        try {
            return mapper.toDBObject(entity);
        } catch (Exception e) {
            throw new MappingException("Could not map entity to DBObject", e);
        }
    }
1121356
@SuppressWarnings("null")
    public static Method getMethod(EvaluationContext ctx, Object base, Object property,
            Class<?>[] paramTypes, Object[] paramValues)
            throws MethodNotFoundException {
        if (base == null || property == null) {
            throw new MethodNotFoundException(MessageFactory.get(
                    "error.method.notfound", base, property,
                    paramString(paramTypes)));
        }

        String methodName = (property instanceof String) ? (String) property
                : property.toString();

        int paramCount;
        if (paramTypes == null) {
            paramCount = 0;
        } else {
            paramCount = paramTypes.length;
        }

        Method[] methods = base.getClass().getMethods();
        Map<Method,MatchResult> candidates = new HashMap<>();

        for (Method m : methods) {
            if (!m.getName().equals(methodName)) {
                // Method name doesn't match
                continue;
            }

            Class<?>[] mParamTypes = m.getParameterTypes();
            //149852 - This was removed due to a findBugs error we felt was worthy of a change.
            //m.getParameterTypes will ALWAYS return an array, it may be of length 0 though
            int mParamCount = mParamTypes.length;

            // Check the number of parameters
            if (!(paramCount == mParamCount ||
                    (m.isVarArgs() && paramCount >= mParamCount))) {
                // Method has wrong number of parameters
                continue;
            }

            // Check the parameters match
            int exactMatch = 0;
            int assignableMatch = 0;
            int coercibleMatch = 0;
            boolean noMatch = false;
            for (int i = 0; i < mParamCount; i++) {
                // Can't be null
                if (mParamTypes[i].equals(paramTypes[i])) {
                    exactMatch++;
                } else if (i == (mParamCount - 1) && m.isVarArgs()) {
                    Class<?> varType = mParamTypes[i].getComponentType();
                    for (int j = i; j < paramCount; j++) {
                        if (isAssignableFrom(paramTypes[j], varType)) {
                            assignableMatch++;
                        } else {
                            if (paramValues == null) {
                                noMatch = true;
                                break;
                            } else {
                                if (isCoercibleFrom(ctx, paramValues[j], varType)) {
                                    coercibleMatch++;
                                } else {
                                    noMatch = true;
                                    break;
                                }
                            }
                        }
                        // Don't treat a varArgs match as an exact match, it can
                        // lead to a varArgs method matching when the result
                        // should be ambiguous
                    }
                } else if (isAssignableFrom(paramTypes[i], mParamTypes[i])) {
                    assignableMatch++;
                } else {
                    if (paramValues == null) {
                        noMatch = true;
                        break;
                    } else {
                        if (isCoercibleFrom(ctx, paramValues[i], mParamTypes[i])) {
                            coercibleMatch++;
                        } else {
                            noMatch = true;
                            break;
                        }
                    }
                }
            }
            if (noMatch) {
                continue;
            }

            // If a method is found where every parameter matches exactly,
            // return it
            if (exactMatch == paramCount) {
                return getMethod(base.getClass(), m);
            }

            candidates.put(m, new MatchResult(
                    exactMatch, assignableMatch, coercibleMatch, m.isBridge()));
        }

        // Look for the method that has the highest number of parameters where
        // the type matches exactly
        MatchResult bestMatch = new MatchResult(0, 0, 0, false);
        Method match = null;
        boolean multiple = false;
        for (Map.Entry<Method, MatchResult> entry : candidates.entrySet()) {
            int cmp = entry.getValue().compareTo(bestMatch);
            if (cmp > 0 || match == null) {
                bestMatch = entry.getValue();
                match = entry.getKey();
                multiple = false;
            } else if (cmp == 0) {
                multiple = true;
            }
        }
        if (multiple) {
            if (bestMatch.getExact() == paramCount - 1) {
                // Only one parameter is not an exact match - try using the
                // super class
                match = resolveAmbiguousMethod(candidates.keySet(), paramTypes);
            } else {
                match = null;
            }

            if (match == null) {
                // If multiple methods have the same matching number of parameters
                // the match is ambiguous so throw an exception
                throw new MethodNotFoundException(MessageFactory.get(
                        "error.method.ambiguous", base, property,
                        paramString(paramTypes)));
                }
        }

        // Handle case where no match at all was found
        if (match == null) {
            throw new MethodNotFoundException(MessageFactory.get(
                        "error.method.notfound", base, property,
                        paramString(paramTypes)));
        }

        return getMethod(base.getClass(), match);
    }
827307
public static Object getProperty(Object obj, String prop) throws PageException {
	Object rtn = getField(obj, prop, NULL);// NULL is used because the field can contain null as well
	if (rtn != NULL) return rtn;

	char first = prop.charAt(0);
	if (first >= '0' && first <= '9') throw new ApplicationException("there is no property with name [" + prop + "]  found in [" + Caster.toTypeName(obj) + "]");
	return callGetter(obj, prop);

    }
1310242
public String setPropertyTypeFromEntityIdValue(
			PropertyIdValue propertyIdValue, EntityIdValue value) {
		switch (value.getId().charAt(0)) {
		case 'Q':
			return DatatypeIdValue.DT_ITEM;
		case 'P':
			return DatatypeIdValue.DT_PROPERTY;
		default:
			logger.warn("Could not determine Type of "
					+ propertyIdValue.getId()
					+ ". It is not a valid EntityDocument Id");
			return null;
		}
	}
767776
public Object fetchValue()
    {
        try
        {
            return m_propertyMetadata.getGetMethod().invoke(m_proxyObject.getObject());
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
896219
public Object getMethodConfigValue(String methodName, String configKey) {
        if (configValueCache == null) {
            return null;
        }
        String key = buildmkey(methodName, configKey);
        return configValueCache.get(key);
    }
1182856
static boolean isJavaPropertyMethod(final String methodName) {
        return (methodName.length() > PROPERTY_METHOD_PREFIX_LEN
                && (methodName.startsWith("get") || methodName.startsWith(("set"))));
    }
416937
public static PropertyMetadata getPropertyMetadata(Field field) {
    Property property = field.getAnnotation(Property.class);
    // For fields that have @Property annotation, we expect both setter and
    // getter methods. For all other fields, we only treat them as
    // persistable if we find valid getter and setter methods.
    try {
      PropertyMetadata propertyMetadata = new PropertyMetadata(field);
      return propertyMetadata;
    } catch (NoAccessorMethodException | NoMutatorMethodException exp) {
      if (property != null) {
        throw exp;
      }
    }
    return null;
  }
92754
public static <T> T invokeGetter(Object obj, String propertyName) {
		Method method = getGetterMethod(obj.getClass(), propertyName);
		if (method == null) {
			throw new IllegalArgumentException(
					"Could not find getter method [" + propertyName + "] on target [" + obj + ']');
		}
		return invokeMethod(obj, method);
	}
325803
public static long getPropertyAsLong(Properties props, String propertyName, long defaultValue) {
        String value = props.getProperty(propertyName, "").trim();
        if (value.isEmpty()) {
            return defaultValue;
        }
        try {
            long val = Long.parseLong(value);
            if (val <= 0) {
                throw new IllegalArgumentException(
                        "Value of " + propertyName + " should be positive, but current value is " + val);
            }
            return val;
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(
                    "Property " + propertyName + " must be a number in Kinesis importer configuration.");
        }
    }
283181
@Override
    protected int findPropertyId(String propName)
    {
        Integer I = sProperties.get(propName);
        return (I == null) ? -1 : I.intValue();
    }
1120008
@SuppressWarnings("unchecked")
	protected <T> JAXBElement<? extends IntuitEntity> getIntuitObject(T entity) {
		Class<?> objectClass = entity.getClass();
		String methodName = "create".concat(objectClass.getSimpleName());
		ObjectFactory objectEntity = new ObjectFactory();
		Class<?> objectEntityClass = objectEntity.getClass();

		Method method = null;
		try {
			method = objectEntityClass.getMethod(methodName, Class.forName(objectClass.getName()));
		} catch (Exception e) {
			LOG.error("Exception while prepare the method signature using reflection to generate JAXBElement", e);
		}
		JAXBElement<? extends IntuitEntity> jaxbElement = null;
		try {
			jaxbElement = (JAXBElement<? extends IntuitEntity>) method.invoke(objectEntity, entity);
		} catch (Exception e) {
			LOG.error("Exception while invoking the method using reflection to generate JAXBElement", e);
		}
		
		return jaxbElement;
	}