public static Object findObject ( PageContext pageContext , String scope , String name , String property , boolean beanRequired , boolean valueRequired ) throws JspTagException { try { // Check the name if ( name == null ) throw new AttributeRequiredException ( "name" ) ; // Find the bean Object bean ; if ( scope == null ) bean = pageContext . findAttribute ( name ) ; else bean = pageContext . getAttribute ( name , Scope . getScopeId ( scope ) ) ; // Check required if ( bean == null ) { if ( beanRequired ) { // null and required if ( scope == null ) throw new LocalizedJspTagException ( ApplicationResources . accessor , "PropertyUtils.bean.required.nullScope" , name ) ; else throw new LocalizedJspTagException ( ApplicationResources . accessor , "PropertyUtils.bean.required.scope" , name , scope ) ; } else { // null and not required return null ; } } else { if ( property == null ) { // No property lookup, use the bean directly return bean ; } else { // Find the property Object value = org . apache . commons . beanutils . PropertyUtils . getProperty ( bean , property ) ; if ( valueRequired && value == null ) { // null and required if ( scope == null ) throw new LocalizedJspTagException ( ApplicationResources . accessor , "PropertyUtils.value.required.nullScope" , property , name ) ; else throw new LocalizedJspTagException ( ApplicationResources . accessor , "PropertyUtils.value.required.scope" , property , name , scope ) ; } return value ; } } } catch ( IllegalAccessException | InvocationTargetException | NoSuchMethodException err ) { throw new JspTagException ( err ) ; } }
Gets the object given its scope name and optional property .