Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // Metawidget
  // This library is free software; you can redistribute it and/or
  // modify it under the terms of the GNU Lesser General Public
  // License as published by the Free Software Foundation; either
  // version 2.1 of the License, or (at your option) any later version.
  // This library is distributed in the hope that it will be useful,
  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // Lesser General Public License for more details.
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 package org.metawidget.inspector.faces;
Configures a FacesXmlInspector prior to use. Once instantiated, Inspectors are immutable.

Richard Kennard
 public class FacesXmlInspectorConfig
 	// Private members
 	private boolean	mInjectThis;
 	// Constructor
 		setDefaultFile"metawidget-metadata.xml" );
 	// Public methods
Overridden to provide a covariant return type for our fluent interface.
 		return (FacesXmlInspectorConfigsuper.setInputStreamstream );

Sets whether the Inspector injects a request-level 'this' attribute into JSF evaluations. False by default.

The problem with XML JSF expressions is that, although the annotation is placed on the business object, the EL expression relies on the UI. If the JSF context is not properly initialized with certain managed bean names, the annotation will not work. This is rather brittle. Injecting 'this' instead allows the EL to function regardless of how the JSF context is configured.

Note: injectThis cannot be used in EL expressions such as faces-lookup. Those expressions are evaluated at a different phase of the JSF lifecycle, possibly without FacesXmlInspector being invoked. For example if a h:selectOneMenu fails to validate during POSTback, its f:selectItems will be redisplayed without a new inspection and with no chance to injectThis.

Note: injectThis also injects a request-level '_this' attribute, for use in EL 2.2 expressions.

this, as part of a fluent interface
 	public FacesXmlInspectorConfig setInjectThisboolean injectThis ) {
 		 = injectThis;
 		// Fluent interface
 		return this;
 	public boolean equalsObject that ) {
 		if ( this == that ) {
 			return true;
		if ( !ObjectUtils.nullSafeClassEqualsthisthat )) {
			return false;
		if (  != ( (FacesXmlInspectorConfigthat ). ) {
			return false;
		return super.equalsthat );
	public int hashCode() {
		int hashCode = super.hashCode();
		hashCode = 31 * hashCode + ObjectUtils.nullSafeHashCode );
		return hashCode;
	// Protected methods
	protected boolean isInjectThis() {
		return ;
New to GrepCode? Check out our FAQ X