public PropertyDescriptor getPropertyDescriptor(Class targetClass, String propertyName) throws IntrospectionException, ReflectionException { try { return OgnlRuntime.getPropertyDescriptor(targetClass, propertyName); } catch (OgnlException e) { throw new ReflectionException(e); } }
/** Determines the index property type, if any. Returns <code>INDEXED_PROPERTY_NONE</code> if the property is not index-accessible as determined by OGNL or JavaBeans. If it is indexable then this will return whether it is a JavaBeans indexed property, conforming to the indexed property patterns (returns <code>INDEXED_PROPERTY_INT</code>) or if it conforms to the OGNL arbitrary object indexable (returns <code>INDEXED_PROPERTY_OBJECT</code>). */ public static final int getIndexedPropertyType( OgnlContext context, Class sourceClass, String name) throws OgnlException { int result = INDEXED_PROPERTY_NONE; try { PropertyDescriptor pd = getPropertyDescriptor(sourceClass, name); if (pd != null) { if (pd instanceof IndexedPropertyDescriptor) { result = INDEXED_PROPERTY_INT; } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { result = INDEXED_PROPERTY_OBJECT; } } } } catch (Exception ex) { throw new OgnlException("problem determining if '" + name + "' is an indexed property", ex); } return result; }
/** * Determines the index property type, if any. Returns <code>INDEXED_PROPERTY_NONE</code> if * the property is not index-accessible as determined by OGNL or JavaBeans. If it is indexable * then this will return whether it is a JavaBeans indexed property, conforming to the indexed * property patterns (returns <code>INDEXED_PROPERTY_INT</code>) or if it conforms to the * OGNL arbitrary object indexable (returns <code>INDEXED_PROPERTY_OBJECT</code>). */ public static int getIndexedPropertyType(OgnlContext context, Class sourceClass, String name) throws OgnlException { int result = INDEXED_PROPERTY_NONE; try { PropertyDescriptor pd = getPropertyDescriptor(sourceClass, name); if (pd != null) { if (pd instanceof IndexedPropertyDescriptor) { result = INDEXED_PROPERTY_INT; } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { result = INDEXED_PROPERTY_OBJECT; } } } } catch (Exception ex) { throw new OgnlException("problem determining if '" + name + "' is an indexed property", ex); } return result; }
/** * Determines the index property type, if any. Returns <code>INDEXED_PROPERTY_NONE</code> if * the property is not index-accessible as determined by OGNL or JavaBeans. If it is indexable * then this will return whether it is a JavaBeans indexed property, conforming to the indexed * property patterns (returns <code>INDEXED_PROPERTY_INT</code>) or if it conforms to the * OGNL arbitrary object indexable (returns <code>INDEXED_PROPERTY_OBJECT</code>). */ public static int getIndexedPropertyType(OgnlContext context, Class sourceClass, String name) throws OgnlException { int result = INDEXED_PROPERTY_NONE; try { PropertyDescriptor pd = getPropertyDescriptor(sourceClass, name); if (pd != null) { if (pd instanceof IndexedPropertyDescriptor) { result = INDEXED_PROPERTY_INT; } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { result = INDEXED_PROPERTY_OBJECT; } } } } catch (Exception ex) { throw new OgnlException("problem determining if '" + name + "' is an indexed property", ex); } return result; }
public static final Method getGetMethod(OgnlContext context, Class targetClass, String propertyName) throws IntrospectionException, OgnlException { Method result = null; PropertyDescriptor pd = getPropertyDescriptor(targetClass, propertyName); if (pd == null) { List methods = getDeclaredMethods(targetClass, propertyName, false /* find 'get' methods */); if (methods != null) { for (int i = 0, icount = methods.size(); i < icount; i++) { Method m = (Method)methods.get(i); Class[] mParameterTypes = getParameterTypes(m); if (mParameterTypes.length == 0) { result = m; break; } } } } else { result = pd.getReadMethod(); } return result; }
public static final Method getSetMethod(OgnlContext context, Class targetClass, String propertyName) throws IntrospectionException, OgnlException { Method result = null; PropertyDescriptor pd = getPropertyDescriptor(targetClass, propertyName); if (pd == null) { List methods = getDeclaredMethods(targetClass, propertyName, true /* find 'set' methods */); if (methods != null) { for (int i = 0, icount = methods.size(); i < icount; i++) { Method m = (Method)methods.get(i); Class[] mParameterTypes = getParameterTypes(m); if (mParameterTypes.length == 1) { result = m; break; } } } } else { result = pd.getWriteMethod(); } return result; }
OgnlContext ogContext=(OgnlContext)context; if (OgnlRuntime.hasSetProperty(ogContext, object, string)) { PropertyDescriptor descriptor=OgnlRuntime.getPropertyDescriptor(object.getClass(), string); Class propertyType=descriptor.getPropertyType(); if ((Collection.class).isAssignableFrom(propertyType)) {
public static Object getIndexedProperty(OgnlContext context, Object source, String name, Object index) throws OgnlException { Object[] args = _objectArrayPool.create(index); try { PropertyDescriptor pd = getPropertyDescriptor((source == null) ? null : source.getClass(), name); Method m; if (pd instanceof IndexedPropertyDescriptor) { m = ((IndexedPropertyDescriptor) pd).getIndexedReadMethod(); } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { m = ((ObjectIndexedPropertyDescriptor) pd).getIndexedReadMethod(); } else { throw new OgnlException("property '" + name + "' is not an indexed property"); } } return callMethod(context, source, m.getName(), args); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException("getting indexed property descriptor for '" + name + "'", ex); } finally { _objectArrayPool.recycle(args); } }
public static final void setIndexedProperty( OgnlContext context, Object source, String name, Object index, Object value ) throws OgnlException { Throwable reason = null; Object[] args = objectArrayPool.create(index, value); try { PropertyDescriptor pd = getPropertyDescriptor((source == null) ? null : source.getClass(), name); Method m; if (pd instanceof IndexedPropertyDescriptor) { m = ((IndexedPropertyDescriptor)pd).getIndexedWriteMethod(); } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { m = ((ObjectIndexedPropertyDescriptor)pd).getIndexedWriteMethod(); } else { throw new OgnlException("property '" + name + "' is not an indexed property"); } } callMethod(context, source, m.getName(), name, args); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException("getting indexed property descriptor for '" + name + "'", ex); } finally { objectArrayPool.recycle(args); } }
public static void setIndexedProperty(OgnlContext context, Object source, String name, Object index, Object value) throws OgnlException { Object[] args = _objectArrayPool.create(index, value); try { PropertyDescriptor pd = getPropertyDescriptor((source == null) ? null : source.getClass(), name); Method m; if (pd instanceof IndexedPropertyDescriptor) { m = ((IndexedPropertyDescriptor) pd).getIndexedWriteMethod(); } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { m = ((ObjectIndexedPropertyDescriptor) pd).getIndexedWriteMethod(); } else { throw new OgnlException("property '" + name + "' is not an indexed property"); } } callMethod(context, source, m.getName(), args); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException("getting indexed property descriptor for '" + name + "'", ex); } finally { _objectArrayPool.recycle(args); } }
public static final Object getIndexedProperty( OgnlContext context, Object source, String name, Object index ) throws OgnlException { Throwable reason = null; Object[] args = objectArrayPool.create(index); try { PropertyDescriptor pd = getPropertyDescriptor((source == null) ? null : source.getClass(), name); Method m; if (pd instanceof IndexedPropertyDescriptor) { m = ((IndexedPropertyDescriptor)pd).getIndexedReadMethod(); } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { m = ((ObjectIndexedPropertyDescriptor)pd).getIndexedReadMethod(); } else { throw new OgnlException("property '" + name + "' is not an indexed property"); } } return callMethod(context, source, m.getName(), name, args); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException("getting indexed property descriptor for '" + name + "'", ex); } finally { objectArrayPool.recycle(args); } }
public static Object getIndexedProperty(OgnlContext context, Object source, String name, Object index) throws OgnlException { Object[] args = _objectArrayPool.create(index); try { PropertyDescriptor pd = getPropertyDescriptor((source == null) ? null : source.getClass(), name); Method m; if (pd instanceof IndexedPropertyDescriptor) { m = ((IndexedPropertyDescriptor) pd).getIndexedReadMethod(); } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { m = ((ObjectIndexedPropertyDescriptor) pd).getIndexedReadMethod(); } else { throw new OgnlException("property '" + name + "' is not an indexed property"); } } return callMethod(context, source, m.getName(), args); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException("getting indexed property descriptor for '" + name + "'", ex); } finally { _objectArrayPool.recycle(args); } }
public static void setIndexedProperty(OgnlContext context, Object source, String name, Object index, Object value) throws OgnlException { Object[] args = _objectArrayPool.create(index, value); try { PropertyDescriptor pd = getPropertyDescriptor((source == null) ? null : source.getClass(), name); Method m; if (pd instanceof IndexedPropertyDescriptor) { m = ((IndexedPropertyDescriptor) pd).getIndexedWriteMethod(); } else { if (pd instanceof ObjectIndexedPropertyDescriptor) { m = ((ObjectIndexedPropertyDescriptor) pd).getIndexedWriteMethod(); } else { throw new OgnlException("property '" + name + "' is not an indexed property"); } } callMethod(context, source, m.getName(), args); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException("getting indexed property descriptor for '" + name + "'", ex); } finally { _objectArrayPool.recycle(args); } }
Class toGetTypeFrom = (collClass != null) ? collClass : c.iterator().next().getClass(); try { keyType = OgnlRuntime.getPropertyDescriptor(toGetTypeFrom, keyProperty).getPropertyType(); } catch (Exception exc) { throw new OgnlException("Error getting property descriptor: " + exc.getMessage());
PropertyDescriptor pd = OgnlRuntime.getPropertyDescriptor(context.getCurrentObject().getClass(), name);
PropertyDescriptor pd = OgnlRuntime.getPropertyDescriptor(context.getCurrentObject().getClass(), name);
PropertyDescriptor pd = OgnlRuntime.getPropertyDescriptor(OgnlRuntime.getCompiler().getInterfaceClass(context.getCurrentObject().getClass()), name);
PropertyDescriptor pd = OgnlRuntime.getPropertyDescriptor(OgnlRuntime.getCompiler().getInterfaceClass(context.getCurrentObject().getClass()), name);