You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/05/06 23:52:40 UTC
svn commit: r653936 [5/6] - in /tapestry/tapestry5/trunk/tapestry-ioc/src:
main/java/org/apache/tapestry/ioc/
main/java/org/apache/tapestry/ioc/internal/
main/java/org/apache/tapestry/ioc/internal/services/
main/java/org/apache/tapestry/ioc/internal/ut...
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java Tue May 6 14:52:36 2008
@@ -22,40 +22,37 @@
import java.util.Arrays;
/**
- * A representation of a {@link java.lang.reflect.Method}, identifying the name, return type,
- * parameter types and exception types. Actual Method objects are tied to a particular class, and
- * don't compare well with other otherwise identical Methods from other classes or interface;
- * MethodSignatures are distinct from classes and compare well.
+ * A representation of a {@link java.lang.reflect.Method}, identifying the name, return type, parameter types and
+ * exception types. Actual Method objects are tied to a particular class, and don't compare well with other otherwise
+ * identical Methods from other classes or interface; MethodSignatures are distinct from classes and compare well.
* <p/>
- * Because the intended purpose is to compare methods from interfaces (which are always public and
- * abstract) we don't bother to actually track the modifiers. In addition, at this time,
- * MethodSignature <em>does not distinguish between instance and static
- * methods</em>.
+ * Because the intended purpose is to compare methods from interfaces (which are always public and abstract) we don't
+ * bother to actually track the modifiers. In addition, at this time, MethodSignature <em>does not distinguish between
+ * instance and static methods</em>.
* <p/>
- * This version of MethodSignature works with <em>loaded</em> classes, and it usually used in the
- * context of {@link org.apache.tapestry.ioc.services.ClassFab} to create new classes and
- * subclasses.
+ * This version of MethodSignature works with <em>loaded</em> classes, and it usually used in the context of {@link
+ * org.apache.tapestry.ioc.services.ClassFab} to create new classes and subclasses.
*/
public class MethodSignature
{
- private int _hashCode = -1;
+ private int hashCode = -1;
- private final Class _returnType;
+ private final Class returnType;
- private final String _name;
+ private final String name;
- private final Class[] _parameterTypes;
+ private final Class[] parameterTypes;
- private final Class[] _exceptionTypes;
+ private final Class[] exceptionTypes;
public MethodSignature(Class returnType, String name, Class[] parameterTypes, Class[] exceptionTypes)
{
- _returnType = notNull(returnType, "returnType");
- _name = notBlank(name, "name");
+ this.returnType = notNull(returnType, "returnType");
+ this.name = notBlank(name, "name");
// Can be null!
- _parameterTypes = parameterTypes;
- _exceptionTypes = exceptionTypes;
+ this.parameterTypes = parameterTypes;
+ this.exceptionTypes = exceptionTypes;
}
public MethodSignature(Method m)
@@ -64,60 +61,58 @@
}
/**
- * Returns the exceptions for this method. Caution: do not modify the returned array. May return
- * null.
+ * Returns the exceptions for this method. Caution: do not modify the returned array. May return null.
*/
public Class[] getExceptionTypes()
{
- return _exceptionTypes;
+ return exceptionTypes;
}
public String getName()
{
- return _name;
+ return name;
}
/**
- * Returns the parameter types for this method. May return null. Caution: do not modify the
- * returned array.
+ * Returns the parameter types for this method. May return null. Caution: do not modify the returned array.
*/
public Class[] getParameterTypes()
{
- return _parameterTypes;
+ return parameterTypes;
}
public Class getReturnType()
{
- return _returnType;
+ return returnType;
}
@Override
public int hashCode()
{
- if (_hashCode == -1)
+ if (hashCode == -1)
{
- _hashCode = _returnType.hashCode();
+ hashCode = returnType.hashCode();
- _hashCode = 31 * _hashCode + _name.hashCode();
+ hashCode = 31 * hashCode + name.hashCode();
- int count = size(_parameterTypes);
+ int count = size(parameterTypes);
for (int i = 0; i < count; i++)
- _hashCode = 31 * _hashCode + _parameterTypes[i].hashCode();
+ hashCode = 31 * hashCode + parameterTypes[i].hashCode();
- count = size(_exceptionTypes);
+ count = size(exceptionTypes);
for (int i = 0; i < count; i++)
- _hashCode = 31 * _hashCode + _exceptionTypes[i].hashCode();
+ hashCode = 31 * hashCode + exceptionTypes[i].hashCode();
}
- return _hashCode;
+ return hashCode;
}
/**
- * Returns true if the other object is an instance of MethodSignature with <em>identical</em>
- * values for return type, name, parameter types and exception types.
+ * Returns true if the other object is an instance of MethodSignature with <em>identical</em> values for return
+ * type, name, parameter types and exception types.
*
* @see #isOverridingSignatureOf(MethodSignature)
*/
@@ -128,13 +123,13 @@
MethodSignature ms = (MethodSignature) o;
- if (_returnType != ms._returnType) return false;
+ if (returnType != ms.returnType) return false;
- if (!_name.equals(ms._name)) return false;
+ if (!name.equals(ms.name)) return false;
- if (mismatch(_parameterTypes, ms._parameterTypes)) return false;
+ if (mismatch(parameterTypes, ms.parameterTypes)) return false;
- return !mismatch(_exceptionTypes, ms._exceptionTypes);
+ return !mismatch(exceptionTypes, ms.exceptionTypes);
}
private boolean mismatch(Class[] a1, Class[] a2)
@@ -160,25 +155,25 @@
{
StringBuilder buffer = new StringBuilder();
- buffer.append(ClassFabUtils.toJavaClassName(_returnType));
+ buffer.append(ClassFabUtils.toJavaClassName(returnType));
buffer.append(" ");
- buffer.append(_name);
+ buffer.append(name);
buffer.append("(");
- for (int i = 0; i < size(_parameterTypes); i++)
+ for (int i = 0; i < size(parameterTypes); i++)
{
if (i > 0) buffer.append(", ");
- buffer.append(ClassFabUtils.toJavaClassName(_parameterTypes[i]));
+ buffer.append(ClassFabUtils.toJavaClassName(parameterTypes[i]));
}
buffer.append(")");
- int _exceptionCount = size(_exceptionTypes);
+ int _exceptionCount = size(exceptionTypes);
String _exceptionNames[] = new String[_exceptionCount];
for (int i = 0; i < _exceptionCount; i++)
{
- _exceptionNames[i] = _exceptionTypes[i].getName();
+ _exceptionNames[i] = exceptionTypes[i].getName();
}
Arrays.sort(_exceptionNames);
@@ -195,23 +190,23 @@
}
/**
- * Returns a string consisting of the name of the method and its parameter values. This is
- * similar to {@link #toString()}, but omits the return type and information about thrown
- * exceptions. A unique id is used by {@link MethodIterator} to identify overlapping methods
- * (methods with the same name and parameter types but with different thrown exceptions).
+ * Returns a string consisting of the name of the method and its parameter values. This is similar to {@link
+ * #toString()}, but omits the return type and information about thrown exceptions. A unique id is used by {@link
+ * MethodIterator} to identify overlapping methods (methods with the same name and parameter types but with
+ * different thrown exceptions).
*
* @see #isOverridingSignatureOf(MethodSignature)
*/
public String getUniqueId()
{
- StringBuilder buffer = new StringBuilder(_name);
+ StringBuilder buffer = new StringBuilder(name);
buffer.append("(");
- for (int i = 0; i < size(_parameterTypes); i++)
+ for (int i = 0; i < size(parameterTypes); i++)
{
if (i > 0) buffer.append(",");
- buffer.append(ClassFabUtils.toJavaClassName(_parameterTypes[i]));
+ buffer.append(ClassFabUtils.toJavaClassName(parameterTypes[i]));
}
buffer.append(")");
@@ -220,31 +215,30 @@
}
/**
- * Returns true if this signature has the same return type, name and parameters types as the
- * method signature passed in, and this signature's exceptions "trump" (are the same as, or
- * super-implementations of, all exceptions thrown by the other method signature).
+ * Returns true if this signature has the same return type, name and parameters types as the method signature passed
+ * in, and this signature's exceptions "trump" (are the same as, or super-implementations of, all exceptions thrown
+ * by the other method signature).
*/
public boolean isOverridingSignatureOf(MethodSignature ms)
{
- if (_returnType != ms._returnType) return false;
+ if (returnType != ms.returnType) return false;
- if (!_name.equals(ms._name)) return false;
+ if (!name.equals(ms.name)) return false;
- if (mismatch(_parameterTypes, ms._parameterTypes)) return false;
+ if (mismatch(parameterTypes, ms.parameterTypes)) return false;
- return exceptionsEncompass(ms._exceptionTypes);
+ return exceptionsEncompass(ms.exceptionTypes);
}
/**
- * The nuts and bolts of checking that another method signature's exceptions are a subset of
- * this signature's.
+ * The nuts and bolts of checking that another method signature's exceptions are a subset of this signature's.
*/
@SuppressWarnings("unchecked")
private boolean exceptionsEncompass(Class[] otherExceptions)
{
- int ourCount = size(_exceptionTypes);
+ int ourCount = size(exceptionTypes);
int otherCount = size(otherExceptions);
// If we have no exceptions, then ours encompass theirs only if they
@@ -266,7 +260,7 @@
// When one of our exceptions is a super-class of one of their exceptions,
// then their exceptions is matched.
- if (_exceptionTypes[i].isAssignableFrom(otherExceptions[j]))
+ if (exceptionTypes[i].isAssignableFrom(otherExceptions[j]))
{
matched[j] = true;
unmatched--;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/MockTester.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/MockTester.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/MockTester.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/MockTester.java Tue May 6 14:52:36 2008
@@ -34,19 +34,19 @@
}
}
- private final ThreadLocalControl _localControl = new ThreadLocalControl();
+ private final ThreadLocalControl localControl = new ThreadLocalControl();
/**
* Invoked after an individual unit test (i.e., a test method invocation) to discard the mock control.
*/
public synchronized void cleanup()
{
- _localControl.remove();
+ localControl.remove();
}
public synchronized IMocksControl getMocksControl()
{
- return _localControl.get();
+ return localControl.get();
}
/**
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java Tue May 6 14:52:36 2008
@@ -56,14 +56,14 @@
}
}
- private final MockTester _tester = new MockTester();
+ private final MockTester tester = new MockTester();
/**
* Returns the {@link IMocksControl} for this thread.
*/
protected final IMocksControl getMocksControl()
{
- return _tester.getMocksControl();
+ return tester.getMocksControl();
}
/**
@@ -72,7 +72,7 @@
@AfterMethod(alwaysRun = true)
public final void discardMockControl()
{
- _tester.cleanup();
+ tester.cleanup();
}
/**
@@ -85,7 +85,7 @@
*/
protected final <T> T newMock(Class<T> mockClass)
{
- return _tester.newMock(mockClass);
+ return tester.newMock(mockClass);
}
/**
@@ -94,7 +94,7 @@
*/
protected final void replay()
{
- _tester.replay();
+ tester.replay();
}
/**
@@ -103,7 +103,7 @@
*/
protected final void verify()
{
- _tester.verify();
+ tester.verify();
}
/**
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java Tue May 6 14:52:36 2008
@@ -25,28 +25,28 @@
import java.util.Map;
/**
- * Abstract implementation of {@link Messages} that doesn't know where values come from (that
- * information is supplied in a subclass, via the {@link #valueForKey(String)} method).
+ * Abstract implementation of {@link Messages} that doesn't know where values come from (that information is supplied in
+ * a subclass, via the {@link #valueForKey(String)} method).
*/
public abstract class AbstractMessages implements Messages
{
- private final ConcurrentBarrier _barrier = new ConcurrentBarrier();
+ private final ConcurrentBarrier barrier = new ConcurrentBarrier();
/**
* String key to MF instance.
*/
- private final Map<String, MessageFormatter> _cache = newCaseInsensitiveMap();
+ private final Map<String, MessageFormatter> cache = newCaseInsensitiveMap();
- private final Locale _locale;
+ private final Locale locale;
protected AbstractMessages(Locale locale)
{
- _locale = locale;
+ this.locale = locale;
}
/**
- * Invoked to provide the value for a particular key. This may be invoked multiple times even
- * for the same key. The implementation should <em>ignore the case of the key</em>.
+ * Invoked to provide the value for a particular key. This may be invoked multiple times even for the same key. The
+ * implementation should <em>ignore the case of the key</em>.
*
* @param key the key to obtain a value for (case insensitive)
* @return the value for the key, or null if this instance can not provide the value
@@ -68,11 +68,11 @@
public MessageFormatter getFormatter(final String key)
{
- MessageFormatter result = _barrier.withRead(new Invokable<MessageFormatter>()
+ MessageFormatter result = barrier.withRead(new Invokable<MessageFormatter>()
{
public MessageFormatter invoke()
{
- return _cache.get(key);
+ return cache.get(key);
}
});
@@ -80,11 +80,11 @@
final MessageFormatter newFormatter = buildMessageFormatter(key);
- _barrier.withWrite(new Runnable()
+ barrier.withWrite(new Runnable()
{
public void run()
{
- _cache.put(key, newFormatter);
+ cache.put(key, newFormatter);
}
});
@@ -95,7 +95,7 @@
{
String format = get(key);
- return new MessageFormatterImpl(format, _locale);
+ return new MessageFormatterImpl(format, locale);
}
public String format(String key, Object... args)
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java Tue May 6 14:52:36 2008
@@ -35,26 +35,26 @@
*/
private static final int DEFAULT_LENGTH = 200;
- private final StringBuilder _buffer = new StringBuilder(DEFAULT_LENGTH);
+ private static final String INDENT = " ";
- private final Formatter _formatter = new Formatter(_buffer);
+ private final StringBuilder buffer = new StringBuilder(DEFAULT_LENGTH);
- // Per level of nesting depth (two spaces).
+ private final Formatter formatter = new Formatter(buffer);
- private static final String INDENT = " ";
+ // Per level of nesting depth (two spaces).
- private int _nestingDepth = 0;
+ private int nestingDepth = 0;
- private boolean _atNewLine = true;
+ private boolean atNewLine = true;
/**
* Clears the builder, returning it to its initial, empty state.
*/
public BodyBuilder clear()
{
- _nestingDepth = 0;
- _atNewLine = true;
- _buffer.setLength(0);
+ nestingDepth = 0;
+ atNewLine = true;
+ buffer.setLength(0);
return this;
}
@@ -91,7 +91,7 @@
// Format output, send to buffer
- _formatter.format(format, args);
+ formatter.format(format, args);
if (newLine) newline();
@@ -100,8 +100,8 @@
private void newline()
{
- _buffer.append("\n");
- _atNewLine = true;
+ buffer.append("\n");
+ atNewLine = true;
}
/**
@@ -109,13 +109,13 @@
*/
public BodyBuilder begin()
{
- if (!_atNewLine) newline();
+ if (!atNewLine) newline();
indent();
- _buffer.append("{");
+ buffer.append("{");
newline();
- _nestingDepth++;
+ nestingDepth++;
return this;
}
@@ -125,14 +125,14 @@
*/
public BodyBuilder end()
{
- if (!_atNewLine) newline();
+ if (!atNewLine) newline();
// TODO: Could check here if nesting depth goes below zero.
- _nestingDepth--;
+ nestingDepth--;
indent();
- _buffer.append("}");
+ buffer.append("}");
newline();
@@ -141,12 +141,12 @@
private void indent()
{
- if (_atNewLine)
+ if (atNewLine)
{
- for (int i = 0; i < _nestingDepth; i++)
- _buffer.append(INDENT);
+ for (int i = 0; i < nestingDepth; i++)
+ buffer.append(INDENT);
- _atNewLine = false;
+ atNewLine = false;
}
}
@@ -160,6 +160,6 @@
@Override
public String toString()
{
- return _buffer.toString();
+ return buffer.toString();
}
}
\ No newline at end of file
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java Tue May 6 14:52:36 2008
@@ -18,16 +18,14 @@
import java.util.*;
/**
- * An mapped collection where the keys are always strings and access to values is case-insensitive.
- * The case of keys in the map is <em>maintained</em>, but on any access to a key (directly or
- * indirectly), all key comparisons are performed in a case-insensitive manner. The map
- * implementation is intended to support a reasonably finite number (dozens or hundreds, not
- * thousands or millions of key/value pairs. Unlike HashMap, it is based on a sorted list of entries
- * rather than hash bucket. It is also geared towards a largely static map, one that is created and
- * then used without modification.
+ * An mapped collection where the keys are always strings and access to values is case-insensitive. The case of keys in
+ * the map is <em>maintained</em>, but on any access to a key (directly or indirectly), all key comparisons are
+ * performed in a case-insensitive manner. The map implementation is intended to support a reasonably finite number
+ * (dozens or hundreds, not thousands or millions of key/value pairs. Unlike HashMap, it is based on a sorted list of
+ * entries rather than hash bucket. It is also geared towards a largely static map, one that is created and then used
+ * without modification.
*
- * @param <V>
- * the type of value stored
+ * @param <V> the type of value stored
*/
public class CaseInsensitiveMap<V> extends AbstractMap<String, V> implements Serializable
{
@@ -41,95 +39,95 @@
{
private static final long serialVersionUID = 6713986085221148350L;
- private String _key;
+ private String key;
- private final int _hashCode;
+ private final int hashCode;
- V _value;
+ V value;
public CIMEntry(final String key, final int hashCode, V value)
{
- _key = key;
- _hashCode = hashCode;
- _value = value;
+ this.key = key;
+ this.hashCode = hashCode;
+ this.value = value;
}
public String getKey()
{
- return _key;
+ return key;
}
public V getValue()
{
- return _value;
+ return value;
}
public V setValue(V value)
{
- V result = _value;
+ V result = this.value;
- _value = value;
+ this.value = value;
return result;
}
/**
- * Returns true if both keys are null, or if the provided key is the same as, or
- * case-insensitively equal to, the entrie's key.
+ * Returns true if both keys are null, or if the provided key is the same as, or case-insensitively equal to,
+ * the entrie's key.
*
* @param key to compare against
* @return true if equal
*/
- @SuppressWarnings({"StringEquality"})
+ @SuppressWarnings({ "StringEquality" })
boolean matches(String key)
{
- return key == _key || (key != null && key.equalsIgnoreCase(_key));
+ return key == this.key || (key != null && key.equalsIgnoreCase(this.key));
}
boolean valueMatches(Object value)
{
- return value == _value || (value != null && value.equals(_value));
+ return value == this.value || (value != null && value.equals(this.value));
}
}
private class EntrySetIterator implements Iterator
{
- int _expectedModCount = _modCount;
+ int expectedModCount = modCount;
- int _index;
+ int index;
- int _current = -1;
+ int current = -1;
public boolean hasNext()
{
- return _index < _size;
+ return index < size;
}
public Object next()
{
check();
- if (_index >= _size) throw new NoSuchElementException();
+ if (index >= size) throw new NoSuchElementException();
- _current = _index++;
+ current = index++;
- return _entries[_current];
+ return entries[current];
}
public void remove()
{
check();
- if (_current < 0) throw new NoSuchElementException();
+ if (current < 0) throw new NoSuchElementException();
- new Position(_current, true).remove();
+ new Position(current, true).remove();
- _expectedModCount = _modCount;
+ expectedModCount = modCount;
}
private void check()
{
- if (_expectedModCount != _modCount) throw new ConcurrentModificationException();
+ if (expectedModCount != modCount) throw new ConcurrentModificationException();
}
}
@@ -145,7 +143,7 @@
@Override
public int size()
{
- return _size;
+ return size;
}
@Override
@@ -188,48 +186,48 @@
private class Position
{
- private final int _cursor;
+ private final int cursor;
- private final boolean _found;
+ private final boolean found;
Position(int cursor, boolean found)
{
- _cursor = cursor;
- _found = found;
+ this.cursor = cursor;
+ this.found = found;
}
boolean isFound()
{
- return _found;
+ return found;
}
CIMEntry<V> entry()
{
- return _entries[_cursor];
+ return entries[cursor];
}
V get()
{
- return _found ? _entries[_cursor]._value : null;
+ return found ? entries[cursor].value : null;
}
V remove()
{
- if (!_found) return null;
+ if (!found) return null;
- V result = _entries[_cursor]._value;
+ V result = entries[cursor].value;
// Remove the entry by shifting everything else down.
- System.arraycopy(_entries, _cursor + 1, _entries, _cursor, _size - _cursor - 1);
+ System.arraycopy(entries, cursor + 1, entries, cursor, size - cursor - 1);
// We shifted down, leaving one (now duplicate) entry behind.
- _entries[--_size] = null;
+ entries[--size] = null;
// A structural change for sure
- _modCount++;
+ modCount++;
return result;
}
@@ -237,56 +235,56 @@
@SuppressWarnings("unchecked")
V put(String key, int hashCode, V newValue)
{
- if (_found)
+ if (found)
{
- CIMEntry<V> e = _entries[_cursor];
+ CIMEntry<V> e = entries[cursor];
- V result = e._value;
+ V result = e.value;
- // Not a structural change, so no change to _modCount
+ // Not a structural change, so no change to modCount
// Update the key (to maintain case). By definition, the hash code
// will not change.
- e._key = key;
- e._value = newValue;
+ e.key = key;
+ e.value = newValue;
return result;
}
// Not found, we're going to add it.
- int newSize = _size + 1;
+ int newSize = size + 1;
- if (newSize == _entries.length)
+ if (newSize == entries.length)
{
// Time to expand!
- int newCapacity = (_size * 3) / 2 + 1;
+ int newCapacity = (size * 3) / 2 + 1;
CIMEntry<V>[] newEntries = new CIMEntry[newCapacity];
- System.arraycopy(_entries, 0, newEntries, 0, _cursor);
+ System.arraycopy(entries, 0, newEntries, 0, cursor);
- System.arraycopy(_entries, _cursor, newEntries, _cursor + 1, _size - _cursor);
+ System.arraycopy(entries, cursor, newEntries, cursor + 1, size - cursor);
- _entries = newEntries;
+ entries = newEntries;
}
else
{
// Open up a space for the new entry
- System.arraycopy(_entries, _cursor, _entries, _cursor + 1, _size - _cursor);
+ System.arraycopy(entries, cursor, entries, cursor + 1, size - cursor);
}
CIMEntry<V> newEntry = new CIMEntry<V>(key, hashCode, newValue);
- _entries[_cursor] = newEntry;
+ entries[cursor] = newEntry;
- _size++;
+ size++;
// This is definately a structural change
- _modCount++;
+ modCount++;
return null;
}
@@ -295,13 +293,13 @@
// The list of entries. This is kept sorted by hash code. In some cases, there may be different
// keys with the same hash code in adjacent indexes.
- private CIMEntry<V>[] _entries;
+ private CIMEntry<V>[] entries;
- private int _size = 0;
+ private int size = 0;
// Used by iterators to check for concurrent modifications
- private transient int _modCount = 0;
+ private transient int modCount = 0;
private transient Set<Map.Entry<String, V>> _entrySet;
@@ -313,7 +311,7 @@
@SuppressWarnings("unchecked")
public CaseInsensitiveMap(int size)
{
- _entries = new CIMEntry[Math.max(size, 3)];
+ entries = new CIMEntry[Math.max(size, 3)];
}
public CaseInsensitiveMap(Map<String, ? extends V> map)
@@ -329,23 +327,23 @@
@Override
public void clear()
{
- for (int i = 0; i < _size; i++)
- _entries[i] = null;
+ for (int i = 0; i < size; i++)
+ entries[i] = null;
- _size = 0;
- _modCount++;
+ size = 0;
+ modCount++;
}
@Override
public boolean isEmpty()
{
- return _size == 0;
+ return size == 0;
}
@Override
public int size()
{
- return _size;
+ return size;
}
@SuppressWarnings("unchecked")
@@ -396,15 +394,15 @@
}
/**
- * Searches the elements for the index of the indicated key and (case insensitive) hash code.
- * Sets the _cursor and _found attributes.
+ * Searches the elements for the index of the indicated key and (case insensitive) hash code. Sets the _cursor and
+ * _found attributes.
*/
private Position select(String key, int hashCode)
{
- if (_size == 0) return new Position(0, false);
+ if (size == 0) return new Position(0, false);
int low = 0;
- int high = _size - 1;
+ int high = size - 1;
int cursor;
@@ -412,15 +410,15 @@
{
cursor = (low + high) >> 1;
- CIMEntry e = _entries[cursor];
+ CIMEntry e = entries[cursor];
- if (e._hashCode < hashCode)
+ if (e.hashCode < hashCode)
{
low = cursor + 1;
continue;
}
- if (e._hashCode > hashCode)
+ if (e.hashCode > hashCode)
{
high = cursor - 1;
continue;
@@ -433,9 +431,9 @@
}
/**
- * select() has located a matching hashCode, but there's an outlying possibility that multiple
- * keys share the same hashCode. Backup the cursor until we get to locate the initial hashCode
- * match, then march forward until the key is located, or the hashCode stops matching.
+ * select() has located a matching hashCode, but there's an outlying possibility that multiple keys share the same
+ * hashCode. Backup the cursor until we get to locate the initial hashCode match, then march forward until the key
+ * is located, or the hashCode stops matching.
*
* @param key
* @param hashCode
@@ -446,14 +444,14 @@
while (cursor > 0)
{
- if (_entries[cursor - 1]._hashCode != hashCode) break;
+ if (entries[cursor - 1].hashCode != hashCode) break;
cursor--;
}
while (true)
{
- if (_entries[cursor].matches(key))
+ if (entries[cursor].matches(key))
{
found = true;
break;
@@ -464,7 +462,7 @@
cursor++;
// If out of entries,
- if (cursor >= _size || _entries[cursor]._hashCode != hashCode) break;
+ if (cursor >= size || entries[cursor].hashCode != hashCode) break;
}
return new Position(cursor, found);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/Stack.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/Stack.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/Stack.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/Stack.java Tue May 6 14:52:36 2008
@@ -28,9 +28,9 @@
private static final int DEFAULT_ARRAY_SIZE = 20;
- private Object[] _items;
+ private Object[] items;
- private int _index = -1;
+ private int index = -1;
/**
* Normal constructor supporting an initial size of 20.
@@ -46,7 +46,7 @@
*/
public Stack(int initialSize)
{
- _items = new Object[Math.max(initialSize, MINIMUM_SIZE)];
+ items = new Object[Math.max(initialSize, MINIMUM_SIZE)];
}
/**
@@ -54,7 +54,7 @@
*/
public boolean isEmpty()
{
- return _index < 0;
+ return index < 0;
}
/**
@@ -62,9 +62,9 @@
*/
public void clear()
{
- for (int i = 0; i <= _index; i++) _items[i] = null;
+ for (int i = 0; i <= index; i++) items[i] = null;
- _index = -1;
+ index = -1;
}
/**
@@ -72,18 +72,18 @@
*/
public void push(E item)
{
- _index++;
+ index++;
- if (_index == _items.length)
+ if (index == items.length)
{
- int newCapacity = (_items.length * 3) / 2 + 1;
+ int newCapacity = (items.length * 3) / 2 + 1;
Object[] newItems = new Object[newCapacity];
- System.arraycopy(_items, 0, newItems, 0, _items.length);
+ System.arraycopy(items, 0, newItems, 0, items.length);
- _items = newItems;
+ items = newItems;
}
- _items[_index] = item;
+ items[index] = item;
}
/**
@@ -97,18 +97,18 @@
{
checkIfEmpty();
- Object result = _items[_index];
+ Object result = items[index];
- _items[_index] = null;
+ items[index] = null;
- _index--;
+ index--;
return (E) result;
}
private void checkIfEmpty()
{
- if (_index < 0) throw new IllegalStateException(UtilMessages.stackIsEmpty());
+ if (index < 0) throw new IllegalStateException(UtilMessages.stackIsEmpty());
}
/**
@@ -122,7 +122,7 @@
{
checkIfEmpty();
- return (E) _items[_index];
+ return (E) items[index];
}
/**
@@ -135,11 +135,11 @@
{
StringBuilder builder = new StringBuilder("Stack[");
- for (int i = _index; i >= 0; i--)
+ for (int i = index; i >= 0; i--)
{
- if (i != _index) builder.append(", ");
+ if (i != index) builder.append(", ");
- builder.append(String.valueOf(_items[i]));
+ builder.append(String.valueOf(items[i]));
}
builder.append("]");
@@ -156,9 +156,9 @@
*/
public Object[] getSnapshot()
{
- Object[] result = new Object[_index + 1];
+ Object[] result = new Object[index + 1];
- System.arraycopy(_items, 0, result, 0, _index + 1);
+ System.arraycopy(items, 0, result, 0, index + 1);
return result;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/StrategyRegistry.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/StrategyRegistry.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/StrategyRegistry.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/StrategyRegistry.java Tue May 6 14:52:36 2008
@@ -23,38 +23,36 @@
import java.util.Map;
/**
- * A key component in implementing the "Gang of Four" Strategy pattern. A StrategyRegistry will
- * match up a given input type with a registered strategy for that type.
+ * A key component in implementing the "Gang of Four" Strategy pattern. A StrategyRegistry will match up a given input
+ * type with a registered strategy for that type.
*
* @param <A> the type of the strategy adapter
*/
public final class StrategyRegistry<A>
{
- private final Class<A> _adapterType;
+ private final Class<A> adapterType;
- private final boolean _allowNonMatch;
+ private final boolean allowNonMatch;
- private final Map<Class, A> _registrations = newMap();
+ private final Map<Class, A> registrations = newMap();
- private final Map<Class, A> _cache = newConcurrentMap();
+ private final Map<Class, A> cache = newConcurrentMap();
/**
- * Used to identify types for which there is no matching adapter; we're using it as if it were
- * a ConcurrentSet.
+ * Used to identify types for which there is no matching adapter; we're using it as if it were a ConcurrentSet.
*/
private final Map<Class, Boolean> _unmatched = newConcurrentMap();
private StrategyRegistry(Class<A> adapterType, Map<Class, A> registrations, boolean allowNonMatch)
{
- _adapterType = adapterType;
- _allowNonMatch = allowNonMatch;
+ this.adapterType = adapterType;
+ this.allowNonMatch = allowNonMatch;
- _registrations.putAll(registrations);
+ this.registrations.putAll(registrations);
}
/**
- * Creates a strategy registry for the given adapter type. The registry will be configured
- * to require matches.
+ * Creates a strategy registry for the given adapter type. The registry will be configured to require matches.
*
* @param adapterType the type of adapter retrieved from the registry
* @param registrations map of registrations (the contents of the map are copied)
@@ -81,18 +79,18 @@
public void clearCache()
{
- _cache.clear();
+ cache.clear();
_unmatched.clear();
}
public Class<A> getAdapterType()
{
- return _adapterType;
+ return adapterType;
}
/**
- * Gets an adapter for an object. Searches based on the value's class, unless the value is null,
- * in which case, a search on class void is used.
+ * Gets an adapter for an object. Searches based on the value's class, unless the value is null, in which case, a
+ * search on class void is used.
*
* @param value for which an adapter is needed
* @return the adapter for the value or null if not found (and allowNonMatch is true)
@@ -114,7 +112,7 @@
public A get(Class type)
{
- A result = _cache.get(type);
+ A result = cache.get(type);
if (result != null) return result;
@@ -128,7 +126,7 @@
if (result != null)
{
- _cache.put(type, result);
+ cache.put(type, result);
}
else
{
@@ -142,22 +140,22 @@
{
for (Class t : new InheritanceSearch(type))
{
- A result = _registrations.get(t);
+ A result = registrations.get(t);
if (result != null) return result;
}
- if (_allowNonMatch) return null;
+ if (allowNonMatch) return null;
// Report the error. These things really confused the hell out of people in Tap4, so we're
// going the extra mile on the exception message.
List<String> names = newList();
- for (Class t : _registrations.keySet())
+ for (Class t : registrations.keySet())
names.add(t.getName());
throw new IllegalArgumentException(UtilMessages
- .noStrategyAdapter(type, _adapterType, names));
+ .noStrategyAdapter(type, adapterType, names));
}
/**
@@ -165,12 +163,12 @@
*/
public Collection<Class> getTypes()
{
- return CollectionFactory.newList(_registrations.keySet());
+ return CollectionFactory.newList(registrations.keySet());
}
@Override
public String toString()
{
- return String.format("StrategyRegistry[%s]", _adapterType.getName());
+ return String.format("StrategyRegistry[%s]", adapterType.getName());
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/TimeInterval.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/TimeInterval.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/TimeInterval.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/TimeInterval.java Tue May 6 14:52:36 2008
@@ -49,7 +49,7 @@
private static final Pattern PATTERN = Pattern.compile("\\s*(\\d+)\\s*([a-z]*)", Pattern.CASE_INSENSITIVE);
- private final long _milliseconds;
+ private final long milliseconds;
/**
* Creates a TimeInterval for a string.
@@ -58,17 +58,17 @@
*/
public TimeInterval(String input)
{
- _milliseconds = parseMilliseconds(input);
+ milliseconds = parseMilliseconds(input);
}
public long milliseconds()
{
- return _milliseconds;
+ return milliseconds;
}
public long seconds()
{
- return _milliseconds / MILLISECOND;
+ return milliseconds / MILLISECOND;
}
static long parseMilliseconds(String input)
@@ -124,7 +124,7 @@
@Override
public String toString()
{
- return String.format("TimeInterval[%d ms]", _milliseconds);
+ return String.format("TimeInterval[%d ms]", milliseconds);
}
@Override
@@ -136,7 +136,7 @@
{
TimeInterval tp = (TimeInterval) obj;
- return _milliseconds == tp._milliseconds;
+ return milliseconds == tp.milliseconds;
}
return false;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/basics.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/basics.apt?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/basics.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/basics.apt Tue May 6 14:52:36 2008
@@ -49,11 +49,11 @@
+----+
public class ExceptionAnalyzerImpl implements ExceptionAnalyzer
{
- private final PropertyAccess _propertyAccess;
+ private final PropertyAccess propertyAccess;
public ExceptionAnalyzerImpl(PropertyAccess propertyAccess)
{
- _propertyAccess = propertyAccess;
+ this.propertyAccess = propertyAccess;
}
. . .
@@ -108,7 +108,7 @@
@Marker(ContextProvider.class)
public AssetFactory buildContextAssetFactory(ApplicationGlobals globals)
{
- return new ContextAssetFactory(_request, globals.getContext());
+ return new ContextAssetFactory(request, globals.getContext());
}
+---+
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/patterns.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/patterns.apt?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/patterns.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/patterns.apt Tue May 6 14:52:36 2008
@@ -89,16 +89,16 @@
+----+
public class InjectWorker implements ComponentClassTransformWorker
{
- private final ObjectLocator _locator;
+ private final ObjectLocator locator;
// Really, a chain of command
- private final InjectionProvider _injectionProvider;
+ private final InjectionProvider injectionProvider;
public InjectWorker(ObjectLocator locator, InjectionProvider injectionProvider)
{
- _locator = locator;
- _injectionProvider = injectionProvider;
+ this.locator = locator;
+ this.injectionProvider = injectionProvider;
}
public final void transform(ClassTransformation transformation, MutableComponentModel model)
@@ -113,10 +113,10 @@
Class type = transformation.toClass(fieldType);
- boolean success = _injectionProvider.provideInjection(
+ boolean success = injectionProvider.provideInjection(
fieldName,
type,
- _locator,
+ locator,
transformation,
model);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/servconf.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/servconf.apt?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/servconf.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/cookbook/servconf.apt Tue May 6 14:52:36 2008
@@ -76,11 +76,11 @@
+----+
public class ResourceDigestGeneratorImpl implements ResourceDigestGenerator
{
- private final Set<String> _digestExtensions;
+ private final Set<String> digestExtensions;
public ResourceDigestGeneratorImpl(Collection<String> configuration)
{
- _digestExtensions = new HashSet<String>(configuration);
+ digestExtensions = new HashSet<String>(configuration);
}
. . .
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/decorator.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/decorator.apt?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/decorator.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/decorator.apt Tue May 6 14:52:36 2008
@@ -240,24 +240,24 @@
{{{../apidocs/org/apache/tapestry/ioc/services/AspectDecorator.html}AspectDecorator}} service
is how you put your MethodAdvise into action.
- By way of an example, we'll show the current implementation of the LoggingDecorator service:
+ By way of an example, we'll show an implementation of the LoggingDecorator service:
+----+
public class LoggingDecoratorImpl implements LoggingDecorator
{
- private final AspectDecorator _aspectDecorator;
+ private final AspectDecorator aspectDecorator;
- private final ExceptionTracker _exceptionTracker;
+ private final ExceptionTracker exceptionTracker;
public LoggingDecoratorImpl(AspectDecorator aspectDecorator, ExceptionTracker exceptionTracker)
{
- _aspectDecorator = aspectDecorator;
- _exceptionTracker = exceptionTracker;
+ this.aspectDecorator = aspectDecorator;
+ this.exceptionTracker = exceptionTracker;
}
public <T> T build(Class<T> serviceInterface, T delegate, String serviceId, final Logger logger)
{
- final ServiceLogger serviceLogger = new ServiceLogger(logger, _exceptionTracker);
+ final ServiceLogger serviceLogger = new ServiceLogger(logger, exceptionTracker);
MethodAdvice advice = new MethodAdvice()
{
@@ -293,13 +293,15 @@
}
};
- return _aspectDecorator.build(serviceInterface, delegate, advice,
+ return aspectDecorator.build(serviceInterface, delegate, advice,
String.format("<Logging interceptor for %s(%s)>", serviceId,
serviceInterface.getName()));
}
}
+---+
+ <The actual code has been refactored slightly since this documentation was written.>
+
Most of the logging logic occurs inside the ServiceLogger object, the MethodAdvice exists to call the right methods at
the right time. A Logger doesn't <change> parameter values (or thrown exceptions, or the result), it just
captures and logs the data.
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/module.apt Tue May 6 14:52:36 2008
@@ -119,20 +119,20 @@
public class MyModule
{
- private final JobScheduler _scheduler;
- private final FileSystem _fileSystem;
+ private final JobScheduler scheduler;
+ private final FileSystem fileSystem;
public MyModule(JobScheduler scheduler, FileSystem fileSystem)
{
- _scheduler = scheduler;
- _fileSystem = fileSystem;
+ this.scheduler = scheduler;
+ this.fileSystem = fileSystem;
}
public Indexer build()
{
- IndexerImpl indexer = new IndexerImpl(_fileSystem);
+ IndexerImpl indexer = new IndexerImpl(fileSystem);
- _scheduler.scheduleDailyJob(indexer);
+ scheduler.scheduleDailyJob(indexer);
return indexer;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/overview.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/overview.apt?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/overview.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/overview.apt Tue May 6 14:52:36 2008
@@ -161,14 +161,14 @@
{
. . .
- private QueueWriter _queueWriter = new QueueWriter();
+ private QueueWriter queueWriter = new QueueWriter();
public void execute()
{
int rowCount = . . .;
Metric metric = new Metric("app/clients", System.currentTimeMillis(), rowCount);
- _queueWriter.sendMetric(metric);
+ queueWriter.sendMetric(metric);
}
+-----+
@@ -179,7 +179,7 @@
to make the QueueWriter shareable:
+----+
- private final QueueWriter _queueWriter = QueueWriter.getInstance();
+ private final QueueWriter queueWriter = QueueWriter.getInstance();
+----+
... and inside class QueueWriter:
@@ -187,7 +187,7 @@
+----+
public class QueueWriter
{
- private static QueueWriter _instance;
+ private static QueueWriter instance;
private QueueWriter()
{
@@ -196,10 +196,10 @@
public static getInstance()
{
- if (_instance == null)
- _instance = new QueueWriter();
+ if (instance == null)
+ instance = new QueueWriter();
- return _instance;
+ return instance;
}
}
+-----+
@@ -209,10 +209,10 @@
+-----+
public synchronized static getInstance()
{
- if (_instance == null)
- _instance = new QueueWriter();
+ if (instance == null)
+ instance = new QueueWriter();
- return _instance;
+ return instance;
}
+----+
@@ -237,7 +237,7 @@
+----+
public class TableMetricProducer implements MetricProducer
{
- private final QueueWriter _queueWriter;
+ private final QueueWriter queueWriter;
/**
* The normal constructor.
@@ -254,7 +254,7 @@
*/
TableMetricProducer(QueueWriter queueWriter, . . .)
{
- _queueWriter = queueWriter;
+ queueWriter = queueWriter;
. . .
}
@@ -263,7 +263,7 @@
int rowCount = . . .;
Metric metric = new Metric("app/clients", System.currentTimeMillis(), rowCount);
- _queueWriter.sendMetric(metric);
+ queueWriter.sendMetric(metric);
}
}
+----+
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/service.apt Tue May 6 14:52:36 2008
@@ -259,11 +259,11 @@
+---+
public class MyServiceImpl implements MyService
{
- private final JobScheduler _jobScheduler;
+ private final JobScheduler jobScheduler;
public MyServiceImpl(@Clustered JobScheduler jobScheduler)
{
- _jobScheduler = jobScheduler;
+ this.jobScheduler = jobScheduler;
}
. . .
@@ -304,12 +304,14 @@
public class IndexerImpl implements Indexer
{
- private final FileSystem _fileSystem;
+ private final FileSystem fileSystem;
public IndexerImpl(@InjectService("FileSystem") FileSystem fileSystem)
{
- _fileSystem = fileSystem;
+ this.fileSystem = fileSystem;
}
+
+ . . .
}
+---+
@@ -332,16 +334,18 @@
public class IndexerImpl implements Indexer
{
- private final FileSystem _fileSystem;
+ private final FileSystem fileSystem;
public IndexerImpl(@InjectService("FileSystem") FileSystem fileSystem,
@InjectService("JobScheduler") JobScheduler scheduler)
{
- _fileSystem = fileSystem;
+ this.fileSystem = fileSystem;
scheduler.scheduleDailyJob(this); // Bad Idea
}
+
+ . . .
}
+---+
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/BarneyModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/BarneyModule.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/BarneyModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/BarneyModule.java Tue May 6 14:52:36 2008
@@ -30,7 +30,7 @@
public class BarneyModule
{
@Match(
- {"UnorderedNames", "Fred", "PrivateFredAlias"})
+ { "UnorderedNames", "Fred", "PrivateFredAlias" })
@Order("after:Beta")
public Object decorateGamma(Object delegate, DecoratorList list)
{
@@ -87,23 +87,23 @@
}
/**
- * Put DecoratorList in module barney, where so it won't accidentally be decorated (which
- * recusively builds the service, and is caught as a failure).
+ * Put DecoratorList in module barney, where so it won't accidentally be decorated (which recusively builds the
+ * service, and is caught as a failure).
*/
public DecoratorList buildDecoratorList()
{
return new DecoratorList()
{
- private List<String> _names = newList();
+ private List<String> names = newList();
public void add(String name)
{
- _names.add(name);
+ names.add(name);
}
public List<String> getNames()
{
- return _names;
+ return names;
}
};
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/CountingGreeterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/CountingGreeterImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/CountingGreeterImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/CountingGreeterImpl.java Tue May 6 14:52:36 2008
@@ -16,11 +16,11 @@
public class CountingGreeterImpl implements Greeter
{
- public static int _instantiationCount;
+ public static int instantiationCount;
public CountingGreeterImpl()
{
- _instantiationCount++;
+ instantiationCount++;
}
public String getGreeting()
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/FredModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/FredModule.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/FredModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/FredModule.java Tue May 6 14:52:36 2008
@@ -16,7 +16,7 @@
import org.apache.tapestry.ioc.annotations.Match;
import org.apache.tapestry.ioc.annotations.Order;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import java.util.Collection;
import java.util.Collections;
@@ -29,8 +29,8 @@
{
/**
- * Doesn't matter what the service does, we just want to verify that the decorators are invoked
- * in the order we expect.
+ * Doesn't matter what the service does, we just want to verify that the decorators are invoked in the order we
+ * expect.
*/
public Runnable buildFred()
{
@@ -43,7 +43,7 @@
}
@Match(
- {"UnorderedNames", "Fred"})
+ { "UnorderedNames", "Fred" })
@Order("before:Beta")
public Object decorateAlpha(Object delegate, DecoratorList list)
{
@@ -53,7 +53,7 @@
}
@Match(
- {"UnorderedNames", "Fred"})
+ { "UnorderedNames", "Fred" })
public Object decorateBeta(Object delegate, DecoratorList list)
{
list.add("beta");
@@ -63,7 +63,7 @@
public NameListHolder buildUnorderedNames(Collection<String> configuration)
{
- final List<String> sorted = newList(configuration);
+ final List<String> sorted = CollectionFactory.newList(configuration);
Collections.sort(sorted);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/IntHolderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/IntHolderImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/IntHolderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/IntHolderImpl.java Tue May 6 14:52:36 2008
@@ -16,16 +16,16 @@
public class IntHolderImpl implements IntHolder
{
- private final int _value;
+ private final int value;
public IntHolderImpl(final int value)
{
- _value = value;
+ this.value = value;
}
public int getValue()
{
- return _value;
+ return value;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java Tue May 6 14:52:36 2008
@@ -742,16 +742,16 @@
{
Registry r = buildRegistry();
- CountingGreeterImpl._instantiationCount = 0;
+ CountingGreeterImpl.instantiationCount = 0;
Greeter g = r.proxy(Greeter.class, CountingGreeterImpl.class);
- assertEquals(CountingGreeterImpl._instantiationCount, 0);
+ assertEquals(CountingGreeterImpl.instantiationCount, 0);
assertEquals(g.toString(),
"<Autobuild proxy org.apache.tapestry.ioc.CountingGreeterImpl(org.apache.tapestry.ioc.Greeter)>");
- assertEquals(CountingGreeterImpl._instantiationCount, 0);
+ assertEquals(CountingGreeterImpl.instantiationCount, 0);
// Show that the class is not instantiated until a method is invoked, and that its
// only instantiated once.
@@ -759,7 +759,7 @@
for (int i = 0; i < 5; i++)
{
assertEquals(g.getGreeting(), "Hello");
- assertEquals(CountingGreeterImpl._instantiationCount, 1);
+ assertEquals(CountingGreeterImpl.instantiationCount, 1);
}
r.shutdown();
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/StaticModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/StaticModule.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/StaticModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/StaticModule.java Tue May 6 14:52:36 2008
@@ -22,11 +22,11 @@
public class StaticModule
{
- private static boolean _instantiated;
+ private static boolean instantiated;
- private static boolean _fredRan;
+ private static boolean fredRan;
- private static boolean _decoratorRan;
+ private static boolean decoratorRan;
public StaticModule()
{
@@ -69,32 +69,32 @@
public static synchronized void setFredRan(boolean fredRan)
{
- _fredRan = fredRan;
+ StaticModule.fredRan = fredRan;
}
public static synchronized boolean getFredRan()
{
- return _fredRan;
+ return fredRan;
}
public static synchronized void setInstantiated(boolean instantiated)
{
- _instantiated = instantiated;
+ StaticModule.instantiated = instantiated;
}
public static synchronized boolean isInstantiated()
{
- return _instantiated;
+ return instantiated;
}
public static synchronized void setDecoratorRan(boolean decoratorRan)
{
- _decoratorRan = decoratorRan;
+ StaticModule.decoratorRan = decoratorRan;
}
public static synchronized boolean getDecoratorRan()
{
- return _decoratorRan;
+ return decoratorRan;
}
public static NameListHolder buildNames(final Collection<String> configuration)
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/StringHolderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/StringHolderImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/StringHolderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/StringHolderImpl.java Tue May 6 14:52:36 2008
@@ -1,17 +1,17 @@
-// Copyright 2006 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.
-
+// Copyright 2006 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.tapestry.ioc;
/**
@@ -19,15 +19,15 @@
*/
public class StringHolderImpl implements StringHolder
{
- private String _value;
+ private String value;
public String getValue()
{
- return _value;
+ return value;
}
public void setValue(String value)
{
- _value = value;
+ this.value = value;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java Tue May 6 14:52:36 2008
@@ -26,7 +26,7 @@
public class ContributionDefImplTest extends IOCTestCase implements ModuleBuilderSource
{
- private Object _toContribute;
+ private Object toContribute;
public Object getModuleBuilder()
{
@@ -37,11 +37,11 @@
@Test
public void unordered_contribution()
{
- _toContribute = new Object();
+ toContribute = new Object();
Configuration configuration = mockConfiguration();
ObjectLocator locator = mockObjectLocator();
- configuration.add(_toContribute);
+ configuration.add(toContribute);
replay();
@@ -161,7 +161,7 @@
@SuppressWarnings("unchecked")
public void contributeUnordered(Configuration configuration)
{
- configuration.add(_toContribute);
+ configuration.add(toContribute);
}
public void contributeUnorderedParameter(Configuration<UpcaseService> configuration,
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java Tue May 6 14:52:36 2008
@@ -37,18 +37,18 @@
public class DefaultModuleDefImplTest extends IOCTestCase
{
- private ClassFactory _classFactory;
+ private ClassFactory classFactory;
@BeforeClass
public void setup()
{
- _classFactory = new ClassFactoryImpl();
+ classFactory = new ClassFactoryImpl();
}
@AfterClass
public void cleanup()
{
- _classFactory = null;
+ classFactory = null;
}
@Test
@@ -62,7 +62,7 @@
// BigDecimal is arbitrary, any class would do.
- ModuleDef md = new DefaultModuleDefImpl(SimpleModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(SimpleModule.class, logger, classFactory);
assertEquals(md.toString(), "ModuleDef[" + className + " Barney, Fred, Wilma]");
@@ -126,10 +126,10 @@
public void service_id_conflict() throws Exception
{
Method conflictMethod = ServiceIdConflictMethodModule.class.getMethod("buildFred");
- String conflictMethodString = InternalUtils.asString(conflictMethod, _classFactory);
+ String conflictMethodString = InternalUtils.asString(conflictMethod, classFactory);
String expectedMethod = InternalUtils.asString(ServiceIdConflictMethodModule.class
- .getMethod("buildFred", Object.class), _classFactory);
+ .getMethod("buildFred", Object.class), classFactory);
Logger logger = mockLogger();
@@ -139,7 +139,7 @@
// BigDecimal is arbitrary, any class would do.
- ModuleDef md = new DefaultModuleDefImpl(ServiceIdConflictMethodModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(ServiceIdConflictMethodModule.class, logger, classFactory);
Set<String> ids = md.getServiceIds();
@@ -276,7 +276,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, classFactory);
Set<ContributionDef> defs = md.getContributionDefs();
@@ -339,7 +339,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(AutobuildModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(AutobuildModule.class, logger, classFactory);
ServiceDef sd = md.getServiceDef("StringHolder");
@@ -358,7 +358,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(ComplexAutobuildModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(ComplexAutobuildModule.class, logger, classFactory);
ServiceDef sd = md.getServiceDef("SH");
@@ -379,7 +379,7 @@
try
{
- new DefaultModuleDefImpl(UninstantiableAutobuildServiceModule.class, logger, _classFactory);
+ new DefaultModuleDefImpl(UninstantiableAutobuildServiceModule.class, logger, classFactory);
unreachable();
}
catch (RuntimeException ex)
@@ -400,7 +400,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(NonStaticBindMethodModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(NonStaticBindMethodModule.class, logger, classFactory);
// Prove that the bind method was not invoke
@@ -431,7 +431,7 @@
replay();
ModuleDef def = new DefaultModuleDefImpl(MutlipleAutobuildServiceConstructorsModule.class, logger,
- _classFactory);
+ classFactory);
ServiceDef sd = def.getServiceDef("StringHolder");
@@ -456,7 +456,7 @@
try
{
- new DefaultModuleDefImpl(ExceptionInBindMethod.class, logger, _classFactory);
+ new DefaultModuleDefImpl(ExceptionInBindMethod.class, logger, classFactory);
unreachable();
}
catch (RuntimeException ex)
@@ -477,7 +477,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(EagerLoadViaAnnotationModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(EagerLoadViaAnnotationModule.class, logger, classFactory);
ServiceDef sd = md.getServiceDef("Runnable");
@@ -493,7 +493,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory);
ServiceDef sd = md.getServiceDef("Greeter");
@@ -509,7 +509,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory);
ServiceDef sd = md.getServiceDef("RedGreeter");
@@ -525,7 +525,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory);
ServiceDef sd = md.getServiceDef("SecondRedGreeter");
@@ -542,7 +542,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, _classFactory);
+ ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory);
ServiceDef sd = md.getServiceDef("SurprisinglyBlueGreeter");
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/MultipleConstructorsAutobuildService.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/MultipleConstructorsAutobuildService.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/MultipleConstructorsAutobuildService.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/MultipleConstructorsAutobuildService.java Tue May 6 14:52:36 2008
@@ -19,7 +19,7 @@
public class MultipleConstructorsAutobuildService implements StringHolder
{
- private final StringHolder _delegate;
+ private final StringHolder delegate;
public MultipleConstructorsAutobuildService()
{
@@ -28,17 +28,17 @@
public MultipleConstructorsAutobuildService(@InjectService("ToUpperCaseStringHolder")StringHolder delegate)
{
- _delegate = delegate;
+ this.delegate = delegate;
}
public String getValue()
{
- return _delegate.getValue();
+ return delegate.getValue();
}
public void setValue(String value)
{
- _delegate.setValue(value);
+ delegate.setValue(value);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodFixture.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodFixture.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodFixture.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodFixture.java Tue May 6 14:52:36 2008
@@ -30,34 +30,34 @@
*/
public class ServiceBuilderMethodFixture extends Assert
{
- FieService _fie;
+ FieService fie;
- String _expectedServiceId;
+ String expectedServiceId;
- ServiceResources _expectedServiceResources;
+ ServiceResources expectedServiceResources;
- Class _expectedServiceInterface;
+ Class expectedServiceInterface;
- Logger _expectedLogger;
+ Logger expectedLogger;
- FoeService _expectedFoe;
+ FoeService expectedFoe;
- Object _expectedConfiguration;
+ Object expectedConfiguration;
- String _expectedString;
+ String expectedString;
public FieService buildWithUnorderedConfiguration(Collection<Runnable> configuration)
{
- assertSame(configuration, _expectedConfiguration);
+ assertSame(configuration, expectedConfiguration);
- return _fie;
+ return fie;
}
public FieService buildWithOrderedConfiguration(List<Runnable> configuration)
{
- assertSame(configuration, _expectedConfiguration);
+ assertSame(configuration, expectedConfiguration);
- return _fie;
+ return fie;
}
public void methodWithParameterizedList(List<Runnable> list)
@@ -75,22 +75,22 @@
public FieService build_noargs()
{
- return _fie;
+ return fie;
}
public FieService build_injected(@InjectService("Foe")
FoeService foe)
{
- assertSame(_expectedFoe, foe);
+ assertSame(expectedFoe, foe);
- return _fie;
+ return fie;
}
public FieService build_auto(FoeService foe)
{
- assertSame(_expectedFoe, foe);
+ assertSame(expectedFoe, foe);
- return _fie;
+ return fie;
}
public FieService build_fail()
@@ -101,21 +101,21 @@
public FieService build_args(String serviceId, ServiceResources resources,
Class serviceInterface, Logger log)
{
- assertEquals(serviceId, _expectedServiceId);
- assertSame(resources, _expectedServiceResources);
- assertSame(serviceInterface, _expectedServiceInterface);
- assertSame(log, _expectedLogger);
+ assertEquals(serviceId, expectedServiceId);
+ assertSame(resources, expectedServiceResources);
+ assertSame(serviceInterface, expectedServiceInterface);
+ assertSame(log, expectedLogger);
- return _fie;
+ return fie;
}
public FieService build_with_forced_injection(@Inject
@Value("Injected")
String string)
{
- assertEquals(string, _expectedString);
+ assertEquals(string, expectedString);
- return _fie;
+ return fie;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodInvokerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodInvokerTest.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodInvokerTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodInvokerTest.java Tue May 6 14:52:36 2008
@@ -42,7 +42,7 @@
ServiceBuilderResources resources = mockServiceBuilderResources();
Logger logger = mockLogger();
- fixture._fie = mockFieService();
+ fixture.fie = mockFieService();
trainForConstructor(resources, logger);
@@ -57,7 +57,7 @@
Object actual = sc.createObject();
- assertSame(actual, fixture._fie);
+ assertSame(actual, fixture.fie);
verify();
}
@@ -80,12 +80,12 @@
Logger logger = mockLogger();
- fixture._expectedServiceId = SERVICE_ID;
- fixture._expectedServiceInterface = FieService.class;
- fixture._expectedServiceResources = resources;
- fixture._expectedLogger = logger;
+ fixture.expectedServiceId = SERVICE_ID;
+ fixture.expectedServiceInterface = FieService.class;
+ fixture.expectedServiceResources = resources;
+ fixture.expectedLogger = logger;
- fixture._fie = mockFieService();
+ fixture.fie = mockFieService();
trainForConstructor(resources, logger);
@@ -101,7 +101,7 @@
Object actual = sc.createObject();
- assertSame(actual, fixture._fie);
+ assertSame(actual, fixture.fie);
verify();
}
@@ -115,9 +115,9 @@
Logger logger = mockLogger();
- fixture._expectedString = "Injected";
+ fixture.expectedString = "Injected";
- fixture._fie = mockFieService();
+ fixture.fie = mockFieService();
trainForConstructor(resources, logger);
@@ -138,7 +138,7 @@
Object actual = sc.createObject();
- assertSame(actual, fixture._fie);
+ assertSame(actual, fixture.fie);
verify();
}
@@ -150,14 +150,14 @@
ServiceBuilderResources resources = mockServiceBuilderResources();
Logger logger = mockLogger();
- fixture._fie = mockFieService();
- fixture._expectedFoe = newFoe();
+ fixture.fie = mockFieService();
+ fixture.expectedFoe = newFoe();
trainForConstructor(resources, logger);
train_getModuleBuilder(resources, fixture);
- train_getService(resources, "Foe", FoeService.class, fixture._expectedFoe);
+ train_getService(resources, "Foe", FoeService.class, fixture.expectedFoe);
train_isDebugEnabled(logger, false);
@@ -168,7 +168,7 @@
Object actual = sc.createObject();
- assertSame(actual, fixture._fie);
+ assertSame(actual, fixture.fie);
verify();
}
@@ -181,9 +181,9 @@
ServiceBuilderResources resources = mockServiceBuilderResources();
Logger logger = mockLogger();
- fixture._fie = mockFieService();
+ fixture.fie = mockFieService();
List<Runnable> result = newMock(List.class);
- fixture._expectedConfiguration = result;
+ fixture.expectedConfiguration = result;
trainForConstructor(resources, logger);
@@ -200,7 +200,7 @@
Object actual = sc.createObject();
- assertSame(actual, fixture._fie);
+ assertSame(actual, fixture.fie);
verify();
@@ -214,9 +214,9 @@
ServiceBuilderResources resources = mockServiceBuilderResources();
Logger logger = mockLogger();
- fixture._fie = mockFieService();
+ fixture.fie = mockFieService();
Collection<Runnable> result = newMock(Collection.class);
- fixture._expectedConfiguration = result;
+ fixture.expectedConfiguration = result;
trainForConstructor(resources, logger);
@@ -233,7 +233,7 @@
Object actual = sc.createObject();
- assertSame(actual, fixture._fie);
+ assertSame(actual, fixture.fie);
verify();
}
@@ -322,15 +322,15 @@
ServiceBuilderResources resources = mockServiceBuilderResources();
Logger logger = mockLogger();
- fixture._fie = mockFieService();
- fixture._expectedFoe = mockFoeService();
+ fixture.fie = mockFieService();
+ fixture.expectedFoe = mockFoeService();
trainForConstructor(resources, logger);
train_getModuleBuilder(resources, fixture);
expect(resources.getObject(eq(FoeService.class), isA(AnnotationProvider.class))).andReturn(
- fixture._expectedFoe);
+ fixture.expectedFoe);
train_isDebugEnabled(logger, false);
@@ -342,7 +342,7 @@
verify();
- assertSame(actual, fixture._fie);
+ assertSame(actual, fixture.fie);
}
protected final void train_getModuleBuilder(ServiceBuilderResources resources,
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceDecoratorFixture.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceDecoratorFixture.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceDecoratorFixture.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceDecoratorFixture.java Tue May 6 14:52:36 2008
@@ -1,17 +1,17 @@
-// Copyright 2006 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.
-
+// Copyright 2006 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.tapestry.ioc.internal;
import org.testng.Assert;
@@ -21,30 +21,30 @@
*/
public class ServiceDecoratorFixture extends Assert
{
- Object _expectedDelegate;
+ Object expectedDelegate;
- Object _interceptorToReturn;
+ Object interceptorToReturn;
- RuntimeException _exception;
+ RuntimeException exception;
public <T> T decoratorReturnsInterceptor(Class<T> serviceInterface, T delegate)
{
assertSame(serviceInterface, FieService.class);
- assertSame(delegate, _expectedDelegate);
+ assertSame(delegate, expectedDelegate);
- return serviceInterface.cast(_interceptorToReturn);
+ return serviceInterface.cast(interceptorToReturn);
}
public Object decoratorUntyped(Object delegate)
{
- assertSame(delegate, _expectedDelegate);
+ assertSame(delegate, expectedDelegate);
- return _interceptorToReturn;
+ return interceptorToReturn;
}
public Object decoratorThrowsException(Object delegate)
{
- throw _exception;
+ throw exception;
}
public Object decorateReturnNull(Object delegate)