org.apache.struts.config.MessageResourcesConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ibis-struts Show documentation
Show all versions of ibis-struts Show documentation
Base project: http://central.maven.org/maven2/struts/struts/1.2.9/
This version of Struts doesn't throw java.io.NotSerializableException when the application server wants to persist sessions and makes renderFocusJavascript return valid xml
The newest version!
/*
* $Id: MessageResourcesConfig.java 264684 2005-08-30 03:08:01Z niallp $
*
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.struts.config;
import java.io.Serializable;
import org.apache.struts.Globals;
/**
* A JavaBean representing the configuration information of a
* <message-resources>
element in a Struts
* configuration file.
*
* @version $Rev: 264684 $ $Date: 2005-08-30 04:08:01 +0100 (Tue, 30 Aug 2005) $
* @since Struts 1.1
*/
public class MessageResourcesConfig implements Serializable {
// ----------------------------------------------------- Instance Variables
/**
* Has this component been completely configured?
*/
protected boolean configured = false;
// ------------------------------------------------------------- Properties
/**
* Fully qualified Java class name of the MessageResourcesFactory class
* we should use.
*/
protected String factory =
"org.apache.struts.util.PropertyMessageResourcesFactory";
public String getFactory() {
return (this.factory);
}
public void setFactory(String factory) {
if (configured) {
throw new IllegalStateException("Configuration is frozen");
}
this.factory = factory;
}
/**
* The servlet context attributes key under which this MessageResources
* instance is stored.
*/
protected String key = Globals.MESSAGES_KEY;
public String getKey() {
return (this.key);
}
public void setKey(String key) {
if (configured) {
throw new IllegalStateException("Configuration is frozen");
}
this.key = key;
}
/**
* Should we return null
for unknown message keys?
*/
protected boolean nullValue = true;
public boolean getNull() {
return (this.nullValue);
}
public void setNull(boolean nullValue) {
if (configured) {
throw new IllegalStateException("Configuration is frozen");
}
this.nullValue = nullValue;
}
/**
* Indicates whether 'escape processing' should be performed on
* the error message string.
*/
private boolean escape = true;
/**
* Indicates whether 'escape processing' should be performed on
* the error message string.
*
* @since Struts 1.2.8
*/
public boolean isEscape() {
return escape;
}
/**
* Set whether 'escape processing' should be performed on
* the error message string.
*
* @since Struts 1.2.8
*/
public void setEscape(boolean escape) {
this.escape = escape;
}
/**
* Parameter that is passed to the createResources()
method
* of our MessageResourcesFactory implementation.
*/
protected String parameter = null;
public String getParameter() {
return (this.parameter);
}
public void setParameter(String parameter) {
if (configured) {
throw new IllegalStateException("Configuration is frozen");
}
this.parameter = parameter;
}
// --------------------------------------------------------- Public Methods
/**
* Freeze the configuration of this component.
*/
public void freeze() {
configured = true;
}
/**
* Return a String representation of this object.
*/
public String toString() {
StringBuffer sb = new StringBuffer("MessageResourcesConfig[");
sb.append("factory=");
sb.append(this.factory);
sb.append(",null=");
sb.append(this.nullValue);
sb.append(",escape=");
sb.append(this.escape);
sb.append(",parameter=");
sb.append(this.parameter);
sb.append("]");
return (sb.toString());
}
}