Example usage for org.jsoup.helper Validate notNull

List of usage examples for org.jsoup.helper Validate notNull

Introduction

In this page you can find the example usage for org.jsoup.helper Validate notNull.

Prototype

public static void notNull(Object obj, String msg) 

Source Link

Document

Validates that the object is not null

Usage

From source file:com.eryansky.modules.disk.service.FileHistoryManager.java

/**
 * ?//from   ww w .j a va 2  s. c  om
 * 
 * @param fileId
 *            
 * @param userId
 *            
 * @return
 */
public FileHistory findUniqueForfileCode(String fileId, String userId) {
    Validate.notNull(fileId, "?[fileId]?null.");
    Validate.notNull(userId, "?[userId]?null.");
    StringBuffer hql = new StringBuffer("");
    Parameter parmas = new Parameter(fileId, userId);
    hql.append(" select h from FileHistory h where h.fileId = :p1 and h.userId = :p2 ");
    return (FileHistory) getEntityDao().createQuery(hql.toString(), parmas).uniqueResult();
}

From source file:com.maiseries.core.bank.web.common.util.Reflections.java

/**
 * ?, ?DeclaredField, ?.// w w  w  .  j  a  v  a 2s .  c om
 * 
 * ?Object?, null.
 */
public static Field getAccessibleField(final Object obj, final String fieldName) {
    Validate.notNull(obj, "object can't be null");
    Validate.notEmpty(fieldName, "fieldName can't be blank");
    for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass
            .getSuperclass()) {
        try {
            Field field = superClass.getDeclaredField(fieldName);
            makeAccessible(field);
            return field;
        } catch (NoSuchFieldException e) {// NOSONAR
            // Field??,?
            continue;// new add
        }
    }
    return null;
}

From source file:com.maiseries.core.bank.web.common.util.Reflections.java

/**
 * ?, ?DeclaredMethod,?. ?Object?, null.
 * ???+?//from ww w. ja v a  2 s. co  m
 * 
 * ?. ?Method,?Method.invoke(Object obj, Object...
 * args)
 */
public static Method getAccessibleMethod(final Object obj, final String methodName,
        final Class<?>... parameterTypes) {
    Validate.notNull(obj, "object can't be null");
    Validate.notEmpty(methodName, "methodName can't be blank");

    for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType
            .getSuperclass()) {
        try {
            Method method = searchType.getDeclaredMethod(methodName, parameterTypes);
            makeAccessible(method);
            return method;
        } catch (NoSuchMethodException e) {
            // Method??,?
            continue;// new add
        }
    }
    return null;
}

From source file:com.maiseries.core.bank.web.common.util.Reflections.java

/**
 * ?, ?DeclaredMethod,?. ?Object?, null. ????
 * /*from w w  w  .  ja v a2 s .  c  o  m*/
 * ?. ?Method,?Method.invoke(Object obj, Object...
 * args)
 */
public static Method getAccessibleMethodByName(final Object obj, final String methodName) {
    Validate.notNull(obj, "object can't be null");
    Validate.notEmpty(methodName, "methodName can't be blank");

    for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType
            .getSuperclass()) {
        Method[] methods = searchType.getDeclaredMethods();
        for (Method method : methods) {
            if (method.getName().equals(methodName)) {
                makeAccessible(method);
                return method;
            }
        }
    }
    return null;
}