Sorry for the big commit, got a bit carried away.
Added override and deprecated annotations wherever they were missing Removed the use of any deprecated classes/methods (except OutputFormat in UtilXml) A few other random generics and misc. cleanups git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@791212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -89,6 +89,7 @@ public class ComponentResourceHandler implements ResourceHandler {
|
||||
return ComponentConfig.getFullLocation(componentName, loaderName, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ComponentResourceHandler) {
|
||||
ComponentResourceHandler other = (ComponentResourceHandler) obj;
|
||||
@@ -102,11 +103,13 @@ public class ComponentResourceHandler implements ResourceHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// the hashCode will weight by a combination componentName and the combination of loaderName and location
|
||||
return (this.componentName.hashCode() + ((this.loaderName.hashCode() + this.location.hashCode()) >> 1)) >> 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ComponentResourceHandler from XML file [" + this.componentName + "] with loaderName [" + loaderName + "] and location [" + location + "]";
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.ofbiz.base.util.*;
|
||||
*/
|
||||
public class ClasspathLoader extends ResourceLoader implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public URL getURL(String location) throws GenericConfigException {
|
||||
String fullLocation = fullLocation(location);
|
||||
URL url = UtilURL.fromResource(fullLocation);
|
||||
@@ -37,6 +38,7 @@ public class ClasspathLoader extends ResourceLoader implements java.io.Serializa
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream loadResource(String location) throws GenericConfigException {
|
||||
URL url = getURL(location);
|
||||
try {
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.ofbiz.base.util.*;
|
||||
*/
|
||||
public class FileLoader extends ResourceLoader implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public URL getURL(String location) throws GenericConfigException {
|
||||
String fullLocation = fullLocation(location);
|
||||
URL fileUrl = null;
|
||||
@@ -39,6 +40,7 @@ public class FileLoader extends ResourceLoader implements java.io.Serializable {
|
||||
return fileUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream loadResource(String location) throws GenericConfigException {
|
||||
URL fileUrl = getURL(location);
|
||||
try {
|
||||
|
||||
@@ -95,6 +95,7 @@ public final class MainResourceHandler implements ResourceHandler {
|
||||
return loader.fullLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof MainResourceHandler) {
|
||||
MainResourceHandler other = (MainResourceHandler) obj;
|
||||
@@ -108,11 +109,13 @@ public final class MainResourceHandler implements ResourceHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// the hashCode will weight by a combination xmlFilename and the combination of loaderName and location
|
||||
return (this.xmlFilename.hashCode() + ((this.loaderName.hashCode() + this.location.hashCode()) >> 1)) >> 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResourceHandler from XML file [" + this.xmlFilename + "] with loaderName [" + loaderName + "] and location [" + location + "]";
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.io.*;
|
||||
*/
|
||||
public class UrlLoader extends ResourceLoader implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public URL getURL(String location) throws GenericConfigException {
|
||||
String fullLocation = fullLocation(location);
|
||||
|
||||
@@ -44,6 +45,7 @@ public class UrlLoader extends ResourceLoader implements java.io.Serializable {
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream loadResource(String location) throws GenericConfigException {
|
||||
URL url = getURL(location);
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ public final class SplashScreen extends Frame {
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics graphics) {
|
||||
if (fImage != null) {
|
||||
graphics.drawImage(fImage, 0, 0, this);
|
||||
|
||||
@@ -150,14 +150,17 @@ public class CachedClassLoader extends URLClassLoader {
|
||||
this(url, parent, "__globalContext");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "org.ofbiz.base.util.CachedClassLoader(" + contextName + ") / " + getParent().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
return loadClass(name, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||
//check glocal common classes, ie for all instances
|
||||
Class<?> theClass = globalClassNameClassMap.get(name);
|
||||
@@ -202,6 +205,7 @@ public class CachedClassLoader extends URLClassLoader {
|
||||
return theClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getResource(String name) {
|
||||
//check glocal common resources, ie for all instances
|
||||
URL theResource = globalResourceMap.get(name);
|
||||
|
||||
@@ -60,10 +60,12 @@ public class DateRange implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DateRange && ((DateRange)obj).start.equals(this.start) && ((DateRange)obj).end.equals(this.end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.start + " - " + this.end;
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ public class GeneralException extends Exception {
|
||||
}
|
||||
|
||||
/** Returns the detail message, including the message from the nested exception if there is one. */
|
||||
@Override
|
||||
public String getMessage() {
|
||||
Throwable nested = getCause();
|
||||
if (nested != null) {
|
||||
@@ -142,16 +143,19 @@ public class GeneralException extends Exception {
|
||||
}
|
||||
|
||||
/** Prints the composite message to System.err. */
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
super.printStackTrace();
|
||||
}
|
||||
|
||||
/** Prints the composite message and the embedded stack trace to the specified stream ps. */
|
||||
@Override
|
||||
public void printStackTrace(PrintStream ps) {
|
||||
super.printStackTrace(ps);
|
||||
}
|
||||
|
||||
/** Prints the composite message and the embedded stack trace to the specified print writer pw. */
|
||||
@Override
|
||||
public void printStackTrace(PrintWriter pw) {
|
||||
super.printStackTrace(pw);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public class GeneralRuntimeException extends RuntimeException {
|
||||
}
|
||||
|
||||
/** Returns the detail message, including the message from the nested exception if there is one. */
|
||||
@Override
|
||||
public String getMessage() {
|
||||
if (nested != null)
|
||||
return super.getMessage() + " (" + nested.getMessage() + ")";
|
||||
@@ -81,18 +82,21 @@ public class GeneralRuntimeException extends RuntimeException {
|
||||
}
|
||||
|
||||
/** Prints the composite message to System.err. */
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
super.printStackTrace();
|
||||
if (nested != null) nested.printStackTrace();
|
||||
}
|
||||
|
||||
/** Prints the composite message and the embedded stack trace to the specified stream ps. */
|
||||
@Override
|
||||
public void printStackTrace(PrintStream ps) {
|
||||
super.printStackTrace(ps);
|
||||
if (nested != null) nested.printStackTrace(ps);
|
||||
}
|
||||
|
||||
/** Prints the composite message and the embedded stack trace to the specified print writer pw. */
|
||||
@Override
|
||||
public void printStackTrace(PrintWriter pw) {
|
||||
super.printStackTrace(pw);
|
||||
if (nested != null) nested.printStackTrace(pw);
|
||||
|
||||
@@ -52,6 +52,7 @@ public class Log4jLoggerWriter extends PrintWriter {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(char[] cbuf, int off, int len) throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException("Writer is closed");
|
||||
@@ -68,12 +69,14 @@ public class Log4jLoggerWriter extends PrintWriter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException("Writer is closed");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
closed = true;
|
||||
}
|
||||
|
||||
@@ -247,6 +247,7 @@ public class MessageString implements Serializable {
|
||||
this.isError = isError;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class ObjectInputStream extends java.io.ObjectInputStream {
|
||||
/**
|
||||
* @see java.io.ObjectInputStream#resolveClass(java.io.ObjectStreamClass)
|
||||
*/
|
||||
@Override
|
||||
protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
|
||||
return ObjectType.loadClass(classDesc.getName(), classloader);
|
||||
}
|
||||
@@ -46,6 +47,7 @@ public class ObjectInputStream extends java.io.ObjectInputStream {
|
||||
/**
|
||||
* @see java.io.ObjectInputStream#resolveProxyClass(java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
|
||||
Class[] cinterfaces = new Class[interfaces.length];
|
||||
for (int i = 0; i < interfaces.length; i++)
|
||||
|
||||
@@ -1239,10 +1239,12 @@ public class ObjectType {
|
||||
public static final class NullObject {
|
||||
public NullObject() { }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ObjectType.NullObject";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof NullObject) {
|
||||
// should do equality of object? don't think so, just same type
|
||||
|
||||
@@ -63,6 +63,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
|
||||
|
||||
public static UtilCache<String, Interpreter.ParsedScript> parsedScripts = new UtilCache<String, Interpreter.ParsedScript>("script.BshBsfParsedCache", 0, 0, false);
|
||||
|
||||
@Override
|
||||
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException {
|
||||
super.initialize(mgr, lang, declaredBeans);
|
||||
|
||||
@@ -135,6 +136,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
|
||||
* It exectutes the funcBody text in an "anonymous" method call with
|
||||
* arguments.
|
||||
*/
|
||||
@Override
|
||||
public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector namesVec, Vector argsVec) throws BSFException {
|
||||
if (namesVec.size() != argsVec.size()) throw new BSFException("number of params/names mismatch");
|
||||
if (!(funcBody instanceof String)) throw new BSFException("apply: function body must be a string");
|
||||
@@ -199,6 +201,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void exec(String source, int lineNo, int columnNo, Object script) throws BSFException {
|
||||
eval(source, lineNo, columnNo, script);
|
||||
}
|
||||
@@ -216,6 +219,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
|
||||
Object script, CodeBuffer cb) throws BSFException;
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void declareBean(BSFDeclaredBean bean) throws BSFException {
|
||||
try {
|
||||
interpreter.set(bean.name, bean.bean);
|
||||
@@ -224,6 +228,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undeclareBean(BSFDeclaredBean bean) throws BSFException {
|
||||
try {
|
||||
interpreter.unset(bean.name);
|
||||
@@ -232,6 +237,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate() { }
|
||||
|
||||
private String sourceInfo(String source, int lineNo, int columnNo) {
|
||||
|
||||
@@ -23,11 +23,13 @@ import java.io.OutputStream;
|
||||
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public class OutputStreamByteCount extends OutputStream {
|
||||
|
||||
protected long byteCount = 0;
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public OutputStreamByteCount() {
|
||||
super();
|
||||
}
|
||||
@@ -35,14 +37,17 @@ public class OutputStreamByteCount extends OutputStream {
|
||||
/**
|
||||
* @see java.io.OutputStream#write(int)
|
||||
*/
|
||||
@Override
|
||||
public void write(int arg0) throws IOException {
|
||||
byteCount++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
byteCount += b.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
byteCount += len;
|
||||
}
|
||||
|
||||
@@ -600,6 +600,7 @@ public class StringUtil {
|
||||
*
|
||||
* @deprecated Use StringUtil.htmlEncoder instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static String htmlSpecialChars(String html, boolean doubleQuotes, boolean singleQuotes, boolean insertBR) {
|
||||
html = StringUtil.replaceString(html, "&", "&");
|
||||
html = StringUtil.replaceString(html, "<", "<");
|
||||
@@ -698,6 +699,7 @@ public class StringUtil {
|
||||
/**
|
||||
* @return The String this object wraps.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.theString;
|
||||
}
|
||||
@@ -709,6 +711,7 @@ public class StringUtil {
|
||||
*/
|
||||
public static class HtmlEncodingMapWrapper<K> implements Map<K, Object>, Reusable {
|
||||
protected static final ObjectFactory<HtmlEncodingMapWrapper<?>> mapStackFactory = new ObjectFactory<HtmlEncodingMapWrapper<?>>() {
|
||||
@Override
|
||||
protected HtmlEncodingMapWrapper<?> create() {
|
||||
return new HtmlEncodingMapWrapper();
|
||||
}
|
||||
@@ -758,6 +761,7 @@ public class StringUtil {
|
||||
public Set<K> keySet() { return this.internalMap.keySet(); }
|
||||
public Collection<Object> values() { return this.internalMap.values(); }
|
||||
public Set<Map.Entry<K, Object>> entrySet() { return this.internalMap.entrySet(); }
|
||||
@Override
|
||||
public String toString() { return this.internalMap.toString(); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ public class TimeDuration implements Serializable {
|
||||
this.set(cal1, cal2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
@@ -80,6 +81,7 @@ public class TimeDuration implements Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.years + ":" + this.months + ":" + this.days + ":" + this.hours + ":" + this.minutes + ":" + this.seconds + ":" + this.millis;
|
||||
}
|
||||
@@ -282,6 +284,7 @@ public class TimeDuration implements Serializable {
|
||||
|
||||
protected static class NullDuration extends TimeDuration {
|
||||
protected NullDuration() {}
|
||||
@Override
|
||||
public Calendar addToCalendar(Calendar cal) {
|
||||
return cal;
|
||||
}
|
||||
|
||||
@@ -911,6 +911,7 @@ public class UtilMisc {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (realMapIfNeeded != null) {
|
||||
return realMapIfNeeded.toString();
|
||||
@@ -929,6 +930,7 @@ public class UtilMisc {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (realMapIfNeeded != null) {
|
||||
return realMapIfNeeded.hashCode();
|
||||
@@ -944,6 +946,7 @@ public class UtilMisc {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (realMapIfNeeded != null) {
|
||||
return realMapIfNeeded.equals(obj);
|
||||
|
||||
@@ -21,9 +21,11 @@ package org.ofbiz.base.util;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public class UtilParse {
|
||||
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public static BigDecimal parseBigDecimalForEntity(String bigDecimalString) throws NumberFormatException {
|
||||
if (bigDecimalString == null) {
|
||||
return null;
|
||||
|
||||
@@ -874,22 +874,27 @@ public class UtilProperties implements java.io.Serializable {
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj == null ? false : obj.hashCode() == this.hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return this.locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object handleGetObject(String key) {
|
||||
return properties.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getKeys() {
|
||||
return new Enumeration<String>() {
|
||||
Iterator i = properties.keySet().iterator();
|
||||
@@ -924,6 +929,7 @@ public class UtilProperties implements java.io.Serializable {
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
@Override
|
||||
public void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException {
|
||||
xmlToProperties(in, null, this);
|
||||
in.close();
|
||||
|
||||
@@ -278,7 +278,7 @@ public class UtilXml {
|
||||
/**
|
||||
* @deprecated Use <a href="#writeXmlDocument(org.w3c.dom.Node,%20java.io.OutputStream,%20java.lang.String,%20boolean,%20boolean,%20int)">writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)</a>
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public static void writeXmlDocument(OutputStream os, Element element, OutputFormat format) throws java.io.IOException {
|
||||
if (element == null) {
|
||||
Debug.logWarning("[UtilXml.writeXmlDocument] Element was null, doing nothing", module);
|
||||
@@ -353,6 +353,7 @@ public class UtilXml {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public static Document readXmlDocument(InputStream is)
|
||||
throws SAXException, ParserConfigurationException, java.io.IOException {
|
||||
return readXmlDocument(is, true, null);
|
||||
@@ -468,41 +469,49 @@ public class UtilXml {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException {
|
||||
super.startGeneralEntity(name, identifier, encoding, augs);
|
||||
setLineColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void comment(XMLString text, Augmentations augs) throws XNIException {
|
||||
super.comment(text, augs);
|
||||
setLastChildLineColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException {
|
||||
super.processingInstruction(target, data, augs);
|
||||
setLastChildLineColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) throws XNIException {
|
||||
super.startDocument(locator, encoding, namespaceContext, augs);
|
||||
this.locator = locator;
|
||||
setLineColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs) throws XNIException {
|
||||
super.doctypeDecl(rootElement, publicId, systemId, augs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(QName elementQName, XMLAttributes attrList, Augmentations augs) throws XNIException {
|
||||
super.startElement(elementQName, attrList, augs);
|
||||
setLineColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(XMLString text, Augmentations augs) throws XNIException {
|
||||
super.characters(text, augs);
|
||||
setLastChildLineColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
|
||||
super.ignorableWhitespace(text, augs);
|
||||
setLastChildLineColumn();
|
||||
|
||||
@@ -36,6 +36,7 @@ public class CacheSoftReference<V> extends SoftReference<V> implements Serializa
|
||||
super(o, referenceQueue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (Debug.verboseOn()) {
|
||||
Debug.logVerbose(new Exception("UtilCache.CacheSoftRef.clear()"), "Clearing UtilCache SoftReference - " + get(), module);
|
||||
@@ -43,6 +44,7 @@ public class CacheSoftReference<V> extends SoftReference<V> implements Serializa
|
||||
super.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalize() throws Throwable {
|
||||
if (Debug.verboseOn()) {
|
||||
Debug.logVerbose(new Exception("UtilCache.CacheSoftRef.finalize()"), "Finalize UtilCache SoftReference - " + get(), module);
|
||||
|
||||
@@ -31,10 +31,12 @@ public final class HardRefCacheLine<V> extends CacheLine<V> {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvalid() {
|
||||
return value == null;
|
||||
}
|
||||
|
||||
@@ -31,10 +31,12 @@ public final class SoftRefCacheLine<V> extends CacheLine<V> {
|
||||
this.ref = new CacheSoftReference<V>(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getValue() {
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvalid() {
|
||||
return ref.get() == null;
|
||||
}
|
||||
|
||||
@@ -196,6 +196,7 @@ public class FlexibleMapAccessor<T> implements Serializable {
|
||||
return expression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.isEmpty()) {
|
||||
return super.toString();
|
||||
@@ -203,6 +204,7 @@ public class FlexibleMapAccessor<T> implements Serializable {
|
||||
return this.original;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
@@ -218,6 +220,7 @@ public class FlexibleMapAccessor<T> implements Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.original == null ? super.hashCode() : this.original.hashCode();
|
||||
}
|
||||
|
||||
@@ -158,6 +158,7 @@ public class FlexibleServletAccessor<T> implements Serializable {
|
||||
/** The equals and hashCode methods are imnplemented just case this object is ever accidently used as a Map key *
|
||||
* @return the hashcode
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.name.hashCode();
|
||||
}
|
||||
@@ -166,6 +167,7 @@ public class FlexibleServletAccessor<T> implements Serializable {
|
||||
* @param obj
|
||||
* @return whether this object is equal to the passed object
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof FlexibleServletAccessor) {
|
||||
FlexibleServletAccessor flexibleServletAccessor = (FlexibleServletAccessor) obj;
|
||||
@@ -185,6 +187,7 @@ public class FlexibleServletAccessor<T> implements Serializable {
|
||||
/** To be used for a string representation of the accessor, returns the original name.
|
||||
* @return the name of this accessor
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public class LRUMap<K, V> extends LinkedHashMap<K, V> {
|
||||
this.maxSize = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry<K, V> entry) {
|
||||
return size() > maxSize;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
|
||||
/**
|
||||
* @see java.util.Collection#size()
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
return backedList.size();
|
||||
}
|
||||
@@ -70,6 +71,7 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
|
||||
/**
|
||||
* @see java.util.Collection#add(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean add(V obj) {
|
||||
int index = backedList.indexOf(obj);
|
||||
|
||||
@@ -87,6 +89,7 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
|
||||
/**
|
||||
* @see java.util.Collection#iterator()
|
||||
*/
|
||||
@Override
|
||||
public Iterator<V> iterator() {
|
||||
return backedList.iterator();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public class MapComparator implements Comparator<Map<Object, Object>> {
|
||||
/**
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj.equals(this);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public class MapStack<K> implements Map<K, Object>, Reusable, LocalizedMap<Objec
|
||||
public static final String module = MapStack.class.getName();
|
||||
|
||||
protected static final ObjectFactory<MapStack<?>> mapStackFactory = new ObjectFactory<MapStack<?>>() {
|
||||
@Override
|
||||
protected MapStack<?> create() {
|
||||
return new MapStack();
|
||||
}
|
||||
@@ -335,6 +336,7 @@ public class MapStack<K> implements Map<K, Object>, Reusable, LocalizedMap<Objec
|
||||
return Collections.unmodifiableSet(resultEntrySet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder fullMapString = new StringBuilder();
|
||||
int curLevel = 0;
|
||||
|
||||
@@ -57,6 +57,7 @@ public class JuelConnector {
|
||||
public ExtendedAstBracket(AstNode base, AstNode property, boolean lvalue, boolean strict) {
|
||||
super(base, property, lvalue, strict);
|
||||
}
|
||||
@Override
|
||||
public void setValue(Bindings bindings, ELContext context, Object value) throws ELException {
|
||||
if (!lvalue) {
|
||||
throw new ELException(LocalMessages.get("error.value.set.rvalue"));
|
||||
@@ -90,6 +91,7 @@ public class JuelConnector {
|
||||
public ExtendedAstDot(AstNode base, String property, boolean lvalue) {
|
||||
super(base, property, lvalue);
|
||||
}
|
||||
@Override
|
||||
public void setValue(Bindings bindings, ELContext context, Object value) throws ELException {
|
||||
if (!lvalue) {
|
||||
throw new ELException(LocalMessages.get("error.value.set.rvalue"));
|
||||
@@ -121,6 +123,7 @@ public class JuelConnector {
|
||||
public ExtendedParser(Builder context, String input) {
|
||||
super(context, input);
|
||||
}
|
||||
@Override
|
||||
protected AstEval eval(boolean required, boolean deferred) throws ScanException, ParseException {
|
||||
AstEval v = null;
|
||||
Symbol start_eval = deferred ? START_EVAL_DEFERRED : START_EVAL_DYNAMIC;
|
||||
@@ -146,9 +149,11 @@ public class JuelConnector {
|
||||
}
|
||||
return v;
|
||||
}
|
||||
@Override
|
||||
protected AstBracket createAstBracket(AstNode base, AstNode property, boolean lvalue, boolean strict) {
|
||||
return new ExtendedAstBracket(base, property, lvalue, strict);
|
||||
}
|
||||
@Override
|
||||
protected AstDot createAstDot(AstNode base, String property, boolean lvalue) {
|
||||
return new ExtendedAstDot(base, property, lvalue);
|
||||
}
|
||||
@@ -157,6 +162,7 @@ public class JuelConnector {
|
||||
/** Custom <code>Builder</code> class needed to implement a custom parser. */
|
||||
@SuppressWarnings("serial")
|
||||
protected static class ExtendedBuilder extends Builder {
|
||||
@Override
|
||||
public Tree build(String expression) throws ELException {
|
||||
try {
|
||||
return new ExtendedParser(this, expression).tree();
|
||||
|
||||
@@ -261,6 +261,7 @@ public class UelFunctions {
|
||||
}
|
||||
Debug.logVerbose("UelFunctions.Functions loaded " + this.functionMap.size() + " functions", module);
|
||||
}
|
||||
@Override
|
||||
public Method resolveFunction(String prefix, String localName) {
|
||||
return functionMap.get(prefix + ":" + localName);
|
||||
}
|
||||
|
||||
@@ -109,12 +109,15 @@ public class UelUtil {
|
||||
public BasicContext(Map<String, ? extends Object> context) {
|
||||
this.variableMapper = new BasicVariableMapper(context, this);
|
||||
}
|
||||
@Override
|
||||
public ELResolver getELResolver() {
|
||||
return defaultResolver;
|
||||
}
|
||||
@Override
|
||||
public FunctionMapper getFunctionMapper() {
|
||||
return UelFunctions.getFunctionMapper();
|
||||
}
|
||||
@Override
|
||||
public VariableMapper getVariableMapper() {
|
||||
return this.variableMapper;
|
||||
}
|
||||
@@ -134,6 +137,7 @@ public class UelUtil {
|
||||
* @param variable the variable's name
|
||||
* @return a BasicValueExpression containing the variable's value or null if the variable is unknown
|
||||
*/
|
||||
@Override
|
||||
public ValueExpression resolveVariable(String variable) {
|
||||
Object obj = null;
|
||||
String createObjectType = null;
|
||||
@@ -189,6 +193,7 @@ public class UelUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ValueExpression setVariable(String variable, ValueExpression expression) {
|
||||
return new BasicValueExpression(this.variables.put(variable, expression.getValue(this.elContext)));
|
||||
}
|
||||
@@ -201,6 +206,7 @@ public class UelUtil {
|
||||
super();
|
||||
this.object = object;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
@@ -214,30 +220,39 @@ public class UelUtil {
|
||||
} catch (Exception e) {}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.object == null ? 0 : this.object.hashCode();
|
||||
}
|
||||
@Override
|
||||
public Object getValue(ELContext context) {
|
||||
return this.object;
|
||||
}
|
||||
@Override
|
||||
public String getExpressionString() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public boolean isLiteralText() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public Class<?> getType(ELContext context) {
|
||||
return this.object == null ? null : this.object.getClass();
|
||||
}
|
||||
@Override
|
||||
public boolean isReadOnly(ELContext context) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void setValue(ELContext context, Object value) {
|
||||
this.object = value;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValueExpression(" + this.object + ")";
|
||||
}
|
||||
@Override
|
||||
public Class<?> getExpectedType() {
|
||||
return this.object == null ? null : this.object.getClass();
|
||||
}
|
||||
@@ -247,6 +262,7 @@ public class UelUtil {
|
||||
* auto-vivify.
|
||||
*/
|
||||
protected static class ExtendedCompositeResolver extends CompositeELResolver {
|
||||
@Override
|
||||
public void setValue(ELContext context, Object base, Object property, Object val) {
|
||||
super.setValue(context, base, property, val);
|
||||
if (!context.isPropertyResolved() && base == null) {
|
||||
@@ -271,6 +287,7 @@ public class UelUtil {
|
||||
super(isReadOnly);
|
||||
this.isReadOnly = isReadOnly;
|
||||
}
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setValue(ELContext context, Object base, Object property, Object val) {
|
||||
if (context == null) {
|
||||
@@ -317,6 +334,7 @@ public class UelUtil {
|
||||
public ExtendedMapResolver(boolean isReadOnly) {
|
||||
super(isReadOnly);
|
||||
}
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getValue(ELContext context, Object base, Object property) {
|
||||
if (context == null) {
|
||||
|
||||
@@ -584,9 +584,11 @@ public class FreeMarkerWorker {
|
||||
this.templateLocation = templateLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return templateLocation.hashCode();
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof FlexibleTemplateSource && obj.hashCode() == this.hashCode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user