📄 settings.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: Settings.java
package org.apache.struts2.config;
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.util.location.Location;
import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
// Referenced classes of package org.apache.struts2.config:
// DefaultSettings
class Settings
{
static Settings settingsImpl;
static Settings defaultImpl;
static Locale locale;
private static final Log LOG = LogFactory.getLog(org/apache/struts2/config/Settings);
Settings()
{
}
public static void setInstance(Settings config)
throws IllegalStateException
{
settingsImpl = config;
locale = null;
}
public static Settings getInstance()
{
return settingsImpl != null ? settingsImpl : getDefaultInstance();
}
public static Locale getLocale()
{
if (locale == null)
try
{
StringTokenizer localeTokens = new StringTokenizer(get("struts.locale"), "_");
String lang = null;
String country = null;
if (localeTokens.hasMoreTokens())
lang = localeTokens.nextToken();
if (localeTokens.hasMoreTokens())
country = localeTokens.nextToken();
locale = new Locale(lang, country);
}
catch (Throwable t)
{
LOG.warn("Settings: Could not parse struts.locale setting, substituting default VM locale");
locale = Locale.getDefault();
}
return locale;
}
public static boolean isSet(String name)
{
return getInstance().isSetImpl(name);
}
public static String get(String name)
throws IllegalArgumentException
{
return getInstance().getImpl(name);
}
public static Location getLocation(String name)
throws IllegalArgumentException
{
return getInstance().getLocationImpl(name);
}
public static Iterator list()
{
return getInstance().listImpl();
}
public boolean isSetImpl(String name)
{
return false;
}
public static void set(String name, String value)
throws IllegalArgumentException, UnsupportedOperationException
{
getInstance().setImpl(name, value);
}
public void setImpl(String name, String value)
throws IllegalArgumentException, UnsupportedOperationException
{
throw new UnsupportedOperationException("Settings: This implementation does not support setting a value.");
}
public String getImpl(String name)
throws IllegalArgumentException
{
return null;
}
public Location getLocationImpl(String name)
throws IllegalArgumentException
{
return null;
}
public Iterator listImpl()
{
throw new UnsupportedOperationException("Settings: This implementation does not support listing the registered settings");
}
private static Settings getDefaultInstance()
{
if (defaultImpl == null)
{
defaultImpl = new DefaultSettings();
try
{
String className = get("struts.configuration");
if (!className.equals(defaultImpl.getClass().getName()))
try
{
defaultImpl = (Settings)ObjectFactory.getObjectFactory().buildBean(Thread.currentThread().getContextClassLoader().loadClass(className), null);
}
catch (Exception e)
{
LOG.error("Settings: Could not instantiate the struts.configuration object, substituting the default implementation.", e);
}
}
catch (IllegalArgumentException ex) { }
}
return defaultImpl;
}
public static void reset()
{
defaultImpl = null;
settingsImpl = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -