List of usage examples for java.lang IllegalAccessException getMessage
public String getMessage()
From source file:me.andpay.ti.util.BeanUtils.java
/** * <p>Clone a bean based on the available property getters and setters, * even if the bean class itself does not implement Cloneable.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean to be cloned/* ww w . j a va 2s. c o m*/ * @return the cloned bean * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception InstantiationException if a new instance of the bean's * class cannot be instantiated * @exception InvocationTargetException if the property accessor method * throws an exception * @exception NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#cloneBean */ public static Object cloneBean(Object bean) { try { return org.apache.commons.beanutils.BeanUtils.cloneBean(bean); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InstantiationException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } catch (NoSuchMethodException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:me.andpay.ti.util.BeanUtils.java
/** * </p>Return the value of the specified mapped property of the specified * bean, as a String.</p>/*from ww w . j a va 2 s . c o m*/ * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean whose property is to be extracted * @param name Simple property name of the property value to be extracted * @param key Lookup key of the property value to be extracted * @return The mapped property's value, converted to a String * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception InvocationTargetException if the property accessor method * throws an exception * @exception NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#getMappedProperty(Object, String, String) */ public static String getMappedProperty(Object bean, String name, String key) { try { return org.apache.commons.beanutils.BeanUtils.getMappedProperty(bean, name, key); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } catch (NoSuchMethodException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:me.andpay.ti.util.BeanUtils.java
/** * <p>Return the value of the specified property of the specified bean, * no matter which property reference format is used, as a String.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean whose property is to be extracted * @param name Possibly indexed and/or nested name of the property * to be extracted// w w w.ja v a 2 s . co m * @return The property's value, converted to a String * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception InvocationTargetException if the property accessor method * throws an exception * @exception NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#getProperty */ public static String getProperty(Object bean, String name) { try { return org.apache.commons.beanutils.BeanUtils.getProperty(bean, name); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } catch (NoSuchMethodException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:me.andpay.ti.util.BeanUtils.java
/** * <p>Return the value of the specified simple property of the specified * bean, converted to a String.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean whose property is to be extracted * @param name Name of the property to be extracted * @return The property's value, converted to a String * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception InvocationTargetException if the property accessor method * throws an exception/* w w w .j a v a 2s.c om*/ * @exception NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#getSimpleProperty */ public static String getSimpleProperty(Object bean, String name) { try { return org.apache.commons.beanutils.BeanUtils.getSimpleProperty(bean, name); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } catch (NoSuchMethodException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:com.mine.core.util.ReflectUtils.java
public static Object getFieldValue(final Object obj, final String fieldName, boolean ignoreNotFond) { Field field = getAccessibleField(obj, fieldName); if (field == null) { if (ignoreNotFond) { return null; } else {//from w w w . j a va 2s .c o m throw new IllegalArgumentException("Could not find field [" + fieldName + ERROR_BLOCK + obj + "]"); } } Object result = null; try { result = field.get(obj); } catch (IllegalAccessException e) { logger.error("??{}", e.getMessage()); } return result; }
From source file:com.mine.core.util.ReflectUtils.java
/** * , private/protected, ??setter. ignoreNotFond-not found * fieldName//from w w w. j a v a 2s .c o m */ public static void setFieldValue(final Object obj, final String fieldName, final Object value, boolean ignoreNotFond) { Field field = getAccessibleField(obj, fieldName); if (field == null) { if (ignoreNotFond) { return; } else { throw new IllegalArgumentException("Could not find field [" + fieldName + ERROR_BLOCK + obj + "]"); } } try { field.set(obj, value); } catch (IllegalAccessException e) { logger.error("??:{}", e.getMessage()); } }
From source file:org.toobsframework.pres.chart.ChartUtil.java
public static Object getDatasetValue(Object datasetRow, DataElement dataElement, Object defaultValue) throws ChartException { try {//from ww w. j a va2s . com if (dataElement != null && dataElement.getIsStatic()) { return dataElement.getPath(); } else if (dataElement != null) { Object value = null; value = BeanMonkey.getPropertyValue(datasetRow, dataElement.getPath()); if (value == null) { value = defaultValue; } return value; } else { return defaultValue; } } catch (IllegalAccessException e) { log.error("Chart data search exception " + e.getMessage(), e); throw new ChartException(e); } catch (InvocationTargetException e) { log.error("Chart data search exception " + e.getMessage(), e); throw new ChartException(e); } catch (NoSuchMethodException e) { log.error("Chart data search exception " + e.getMessage(), e); throw new ChartException(e); } }
From source file:org.wso2.carbon.custom.connector.EJBUtil.java
/** * @param messageContext messageContext/*from w w w . j ava 2 s .c o m*/ * @param jndiName jndi name * @return ejb remote object */ public static Object getEJBObject(MessageContext messageContext, String jndiName) { Object ejbObject = null; try { InitialContext context = new InitialContext( (Properties) messageContext.getProperty(EJBConstants.JNDI_PROPERTIES)); Object obj = context.lookup(getParameter(messageContext, jndiName).toString()); EJBHome ejbHome = (EJBHome) PortableRemoteObject.narrow(obj, EJBHome.class); Method method = ejbHome.getClass().getDeclaredMethod(EJBConstants.CREATE); if (method != null) { ejbObject = method.invoke(ejbHome); } else handleException("ejb home is missing "); } catch (IllegalAccessException e) { handleException("Failed to get ejb Object because of IllegalAccessException ", e); } catch (InvocationTargetException e) { handleException("Failed to get ejb Object because of InvocationTargetException ", e); } catch (NoSuchMethodException e) { handleException("Failed lookup because of create method not exist " + e.getMessage()); } catch (NamingException e) { handleException("Failed lookup because of NamingException ", e); } return ejbObject; }
From source file:org.apache.beehive.netui.pageflow.MultipartRequestUtils.java
/** * Create an implementation of a {@link MultipartRequestHandler} for this * mulitpart request.//www .j a va 2 s .co m * * @param request the current request object * @return the handler * @throws ServletException if an error occurs loading this file. These exception messages * are not internationalized as Struts does not internationalize them either. */ // @Struts: org.apache.struts.util.RequestUtils.getMultipartHandler private static final MultipartRequestHandler getMultipartHandler(HttpServletRequest request) throws ServletException { MultipartRequestHandler multipartHandler = null; String multipartClass = (String) request.getAttribute(Globals.MULTIPART_KEY); request.removeAttribute(Globals.MULTIPART_KEY); // Try to initialize the mapping specific request handler if (multipartClass != null) { try { multipartHandler = (MultipartRequestHandler) RequestUtils.applicationInstance(multipartClass); } catch (ClassNotFoundException cnfe) { _log.error("MultipartRequestHandler class \"" + multipartClass + "\" in mapping class not found, " + "defaulting to global multipart class"); } catch (InstantiationException ie) { _log.error( "InstantiaionException when instantiating " + "MultipartRequestHandler \"" + multipartClass + "\", " + "defaulting to global multipart class, exception: " + ie.getMessage()); } catch (IllegalAccessException iae) { _log.error( "IllegalAccessException when instantiating " + "MultipartRequestHandler \"" + multipartClass + "\", " + "defaulting to global multipart class, exception: " + iae.getMessage()); } if (multipartHandler != null) return multipartHandler; } ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); multipartClass = moduleConfig.getControllerConfig().getMultipartClass(); // Try to initialize the global request handler if (multipartClass != null) { try { multipartHandler = (MultipartRequestHandler) RequestUtils.applicationInstance(multipartClass); } catch (ClassNotFoundException cnfe) { throw new ServletException("Cannot find multipart class \"" + multipartClass + "\"" + ", exception: " + cnfe.getMessage()); } catch (InstantiationException ie) { throw new ServletException("InstantiaionException when instantiating " + "multipart class \"" + multipartClass + "\", exception: " + ie.getMessage()); } catch (IllegalAccessException iae) { throw new ServletException("IllegalAccessException when instantiating " + "multipart class \"" + multipartClass + "\", exception: " + iae.getMessage()); } if (multipartHandler != null) return multipartHandler; } return multipartHandler; }
From source file:com.thinkbiganalytics.metadata.jpa.support.GenericQueryDslFilter.java
/** * Gets the correct path walking the objects if supplied via dot notation. Example a column value of jobInstance.jobName will return the Path for the jobName If an error occurs it will be logged * and not included in the query/*from ww w .j a v a 2s . c om*/ */ private static Path<?> buildPathFromFilterColumn(EntityPathBase basePath, String column) { try { String resolvedFilter = CommonFilterTranslations.resolvedFilter(basePath, column); return (Path<?>) QueryDslPathInspector.getFieldObject(basePath, resolvedFilter); } catch (IllegalAccessException e) { log.warn( "Unable to add {} to Query filter. Unable to return the correct Query Path for field: {} on Object: {}, Error: {} ", column, column, basePath, e.getMessage()); } return null; }