Example usage for java.lang NoSuchMethodException NoSuchMethodException

List of usage examples for java.lang NoSuchMethodException NoSuchMethodException

Introduction

In this page you can find the example usage for java.lang NoSuchMethodException NoSuchMethodException.

Prototype

public NoSuchMethodException() 

Source Link

Document

Constructs a NoSuchMethodException without a detail message.

Usage

From source file:Main.java

public static <I, P extends I> Method findMethod(final Object obj, final String name, final P param,
        final Class<I> type) throws NoSuchMethodException {

    Class<?> c = obj.getClass();

    while (c != null && c != Object.class) {
        try {// ww w  .j  a v a 2  s.com
            return c.getDeclaredMethod(name, type);
        } catch (final Exception e) {
        }
        c = c.getSuperclass();
    }

    throw new NoSuchMethodException();

}

From source file:jp.terasoluna.fw.util.ConvertUtil_PropertyUtilsBeanStub02.java

/**
 * ?NoSuchMethodException?/*from   www  .  ja va  2 s .  co  m*/
 * @param bean Bean whose properties are to be extracted
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Map describe(Object bean)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    throw new NoSuchMethodException();
}

From source file:ubic.gemma.core.loader.util.ParserAndLoaderTools.java

public static Method findParseLineMethod(Object obj, String fileName) throws NoSuchMethodException {
    String[] f = StringUtils.split(fileName, System.getProperty("file.separator"));
    String suffixOfFilename = f[f.length - 1];
    assert obj != null;
    Method[] methods = obj.getClass().getMethods();
    for (Method m : methods) {
        if (m.getName().toLowerCase().contains((suffixOfFilename).toLowerCase())
                && m.getName().startsWith("mapFrom")) {
            return m;
        }//ww w.  j a va2  s.  c o  m
    }
    throw new NoSuchMethodException();
}

From source file:org.braiden.fpm2.util.PropertyUtils.java

public static void setProperty(Object bean, String property, Object value)
        throws InvocationTargetException, IllegalAccessException {
    Validate.notNull(bean);/* w ww.  j  a v a 2 s  . co  m*/
    Validate.notEmpty(property);
    Method method = findMethod(bean.getClass(), property, SETTER);
    if (method == null) {
        throw new InvocationTargetException(new NoSuchMethodException());
    }
    method.invoke(bean, value);
}

From source file:ubic.gemma.loader.util.ParserAndLoaderTools.java

/**
 * @param obj/*from  w  w w  . j  av a 2s  . c o  m*/
 * @param fileName
 * @return
 * @throws NoSuchMethodException
 */
public static Method findParseLineMethod(Object obj, String fileName) throws NoSuchMethodException {
    String[] f = StringUtils.split(fileName, System.getProperty("file.separator"));
    String suffixOfFilename = f[f.length - 1];
    assert obj != null;
    Method[] methods = obj.getClass().getMethods();
    for (Method m : methods) {
        if (m.getName().toLowerCase().contains((suffixOfFilename).toLowerCase())
                && m.getName().startsWith("mapFrom")) {
            return m;
        }
    }
    throw new NoSuchMethodException();
}

From source file:org.braiden.fpm2.util.PropertyUtils.java

public static Object getProperty(Object bean, String property)
        throws InvocationTargetException, IllegalAccessException {
    Validate.notNull(bean);/* w w w  .ja va2 s.c  o  m*/
    Validate.notEmpty(property);
    Method method = findMethod(bean.getClass(), property, GETTER);
    if (method == null) {
        throw new InvocationTargetException(new NoSuchMethodException());
    }
    return method.invoke(bean);
}

From source file:org.red5.server.api.persistence.PersistenceUtils.java

/**
 * Returns persistence store object. Persistence store is a special object that stores persistence objects and provides methods to manipulate them (save, load, remove, list).
 * //from w ww .j a va  2s .  c o m
 * @param resolver
 *            Resolves connection pattern into Resource object
 * @param className
 *            Name of persistence class
 * @return IPersistence store object that provides methods for persistence object handling
 * @throws Exception
 *             if error
 */
public static IPersistenceStore getPersistenceStore(ResourcePatternResolver resolver, String className)
        throws Exception {
    Class<?> persistenceClass = Class.forName(className);
    Constructor<?> constructor = getPersistenceStoreConstructor(persistenceClass,
            resolver.getClass().getInterfaces());
    if (constructor == null) {
        // Search in superclasses of the object.
        Class<?> superClass = resolver.getClass().getSuperclass();
        while (superClass != null) {
            constructor = getPersistenceStoreConstructor(persistenceClass, superClass.getInterfaces());
            if (constructor != null) {
                break;
            }
            superClass = superClass.getSuperclass();
        }
    }
    if (constructor == null) {
        throw new NoSuchMethodException();
    }
    return (IPersistenceStore) constructor.newInstance(new Object[] { resolver });
}

From source file:fr.paris.lutece.util.method.MethodUtil.java

/**
 * Sets the attribute.// ww  w .j  ava  2s  .co m
 * <br />
 * <strong>Warning :</warning> This method does not handle setter that :
 * <ul>
 * <li>has no parameter or has more than one parameter</li>
 * <li>has array parameter (ie : String[] or int[] ...)</li>
 * </ul>
 *
 * @param <A> the generic type of the instance
 * @param <B> the generic type of the value to set
 * @param instance the instance to set
 * @param strAttributeName the attribute name
 * @param value the value of the attribute to set
 * @throws SecurityException the security exception
 * @throws NoSuchMethodException the no such method exception
 * @throws IllegalArgumentException the illegal argument exception
 * @throws IllegalAccessException the illegal access exception
 * @throws InvocationTargetException the invocation target exception
 */
public static <A, B> void set(A instance, String strAttributeName, B value) throws SecurityException,
        NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    if (StringUtils.isNotBlank(strAttributeName) && (instance != null) && (value != null)) {
        Method methodSetter = getSetter(instance, strAttributeName, value.getClass());

        if (methodSetter != null) {
            methodSetter.invoke(instance, new Object[] { value });
        } else {
            throw new NoSuchMethodException();
        }
    } else {
        throw new IllegalArgumentException("One on the parameters is null/blank.");
    }
}

From source file:pt.webdetails.cdb.CdbContentGenerator.java

@Override
protected Method getMethod(String methodName) throws NoSuchMethodException {
    Method method = exposedMethods.get(StringUtils.lowerCase(methodName));
    if (method == null) {
        throw new NoSuchMethodException();
    }//  w w  w  .  j  a v a 2  s  . com
    return method;
}

From source file:com.link_intersystems.lang.reflect.SerializableConstructorTest.java

@Override
protected Constructor<?> getConstructor(Class<?> declaringClass, Class<?>[] parameterTypes)
        throws NoSuchMethodException {
    throw new NoSuchMethodException();
}