Updated regarding generics; fixed typos.

This commit is contained in:
Sam Brannen 2009-05-25 09:04:05 +00:00
parent 5f473b9f26
commit af56f6497c
4 changed files with 40 additions and 36 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -115,7 +115,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
else { else {
// Create and activate new context builder. // Create and activate new context builder.
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
// The activate() call will cause an assigment to the activated variable. // The activate() call will cause an assignment to the activated variable.
builder.activate(); builder.activate();
} }
return activated; return activated;
@ -124,7 +124,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
private final Log logger = LogFactory.getLog(getClass()); private final Log logger = LogFactory.getLog(getClass());
private final Hashtable boundObjects = new Hashtable(); private final Hashtable<String,Object> boundObjects = new Hashtable<String,Object>();
/** /**
@ -156,7 +156,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
* Temporarily deactivate this context builder. It will remain registered with * Temporarily deactivate this context builder. It will remain registered with
* the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory * the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory
* (if configured) instead of exposing its own bound objects. * (if configured) instead of exposing its own bound objects.
* <p>Call <code>activate()</code> again in order to expose this contexz builder's own * <p>Call <code>activate()</code> again in order to expose this context builder's own
* bound objects again. Such activate/deactivate sequences can be applied any number * bound objects again. Such activate/deactivate sequences can be applied any number
* of times (e.g. within a larger integration test suite running in the same VM). * of times (e.g. within a larger integration test suite running in the same VM).
* @see #activate() * @see #activate()
@ -192,13 +192,13 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
* creating a new SimpleNamingContext instance. * creating a new SimpleNamingContext instance.
* @see SimpleNamingContext * @see SimpleNamingContext
*/ */
public InitialContextFactory createInitialContextFactory(Hashtable environment) { public InitialContextFactory createInitialContextFactory(Hashtable<?,?> environment) {
if (activated == null && environment != null) { if (activated == null && environment != null) {
Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY); Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY);
if (icf != null) { if (icf != null) {
Class icfClass = null; Class<?> icfClass = null;
if (icf instanceof Class) { if (icf instanceof Class) {
icfClass = (Class) icf; icfClass = (Class<?>) icf;
} }
else if (icf instanceof String) { else if (icf instanceof String) {
icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader()); icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader());
@ -225,8 +225,9 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
// Default case... // Default case...
return new InitialContextFactory() { return new InitialContextFactory() {
public Context getInitialContext(Hashtable environment) { @SuppressWarnings("unchecked")
return new SimpleNamingContext("", boundObjects, environment); public Context getInitialContext(Hashtable<?,?> environment) {
return new SimpleNamingContext("", boundObjects, (Hashtable<String, Object>) environment);
} }
}; };
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -115,7 +115,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
else { else {
// Create and activate new context builder. // Create and activate new context builder.
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
// The activate() call will cause an assigment to the activated variable. // The activate() call will cause an assignment to the activated variable.
builder.activate(); builder.activate();
} }
return activated; return activated;
@ -124,7 +124,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
private final Log logger = LogFactory.getLog(getClass()); private final Log logger = LogFactory.getLog(getClass());
private final Hashtable boundObjects = new Hashtable(); private final Hashtable<String,Object> boundObjects = new Hashtable<String,Object>();
/** /**
@ -156,7 +156,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
* Temporarily deactivate this context builder. It will remain registered with * Temporarily deactivate this context builder. It will remain registered with
* the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory * the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory
* (if configured) instead of exposing its own bound objects. * (if configured) instead of exposing its own bound objects.
* <p>Call <code>activate()</code> again in order to expose this contexz builder's own * <p>Call <code>activate()</code> again in order to expose this context builder's own
* bound objects again. Such activate/deactivate sequences can be applied any number * bound objects again. Such activate/deactivate sequences can be applied any number
* of times (e.g. within a larger integration test suite running in the same VM). * of times (e.g. within a larger integration test suite running in the same VM).
* @see #activate() * @see #activate()
@ -192,13 +192,13 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
* creating a new SimpleNamingContext instance. * creating a new SimpleNamingContext instance.
* @see SimpleNamingContext * @see SimpleNamingContext
*/ */
public InitialContextFactory createInitialContextFactory(Hashtable environment) { public InitialContextFactory createInitialContextFactory(Hashtable<?,?> environment) {
if (activated == null && environment != null) { if (activated == null && environment != null) {
Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY); Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY);
if (icf != null) { if (icf != null) {
Class icfClass = null; Class<?> icfClass = null;
if (icf instanceof Class) { if (icf instanceof Class) {
icfClass = (Class) icf; icfClass = (Class<?>) icf;
} }
else if (icf instanceof String) { else if (icf instanceof String) {
icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader()); icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader());
@ -225,8 +225,9 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
// Default case... // Default case...
return new InitialContextFactory() { return new InitialContextFactory() {
public Context getInitialContext(Hashtable environment) { @SuppressWarnings("unchecked")
return new SimpleNamingContext("", boundObjects, environment); public Context getInitialContext(Hashtable<?,?> environment) {
return new SimpleNamingContext("", boundObjects, (Hashtable<String, Object>) environment);
} }
}; };
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -115,7 +115,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
else { else {
// Create and activate new context builder. // Create and activate new context builder.
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
// The activate() call will cause an assigment to the activated variable. // The activate() call will cause an assignment to the activated variable.
builder.activate(); builder.activate();
} }
return activated; return activated;
@ -124,7 +124,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
private final Log logger = LogFactory.getLog(getClass()); private final Log logger = LogFactory.getLog(getClass());
private final Hashtable boundObjects = new Hashtable(); private final Hashtable<String,Object> boundObjects = new Hashtable<String,Object>();
/** /**
@ -156,7 +156,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
* Temporarily deactivate this context builder. It will remain registered with * Temporarily deactivate this context builder. It will remain registered with
* the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory * the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory
* (if configured) instead of exposing its own bound objects. * (if configured) instead of exposing its own bound objects.
* <p>Call <code>activate()</code> again in order to expose this contexz builder's own * <p>Call <code>activate()</code> again in order to expose this context builder's own
* bound objects again. Such activate/deactivate sequences can be applied any number * bound objects again. Such activate/deactivate sequences can be applied any number
* of times (e.g. within a larger integration test suite running in the same VM). * of times (e.g. within a larger integration test suite running in the same VM).
* @see #activate() * @see #activate()
@ -192,13 +192,13 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
* creating a new SimpleNamingContext instance. * creating a new SimpleNamingContext instance.
* @see SimpleNamingContext * @see SimpleNamingContext
*/ */
public InitialContextFactory createInitialContextFactory(Hashtable environment) { public InitialContextFactory createInitialContextFactory(Hashtable<?,?> environment) {
if (activated == null && environment != null) { if (activated == null && environment != null) {
Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY); Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY);
if (icf != null) { if (icf != null) {
Class icfClass = null; Class<?> icfClass = null;
if (icf instanceof Class) { if (icf instanceof Class) {
icfClass = (Class) icf; icfClass = (Class<?>) icf;
} }
else if (icf instanceof String) { else if (icf instanceof String) {
icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader()); icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader());
@ -225,8 +225,9 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
// Default case... // Default case...
return new InitialContextFactory() { return new InitialContextFactory() {
public Context getInitialContext(Hashtable environment) { @SuppressWarnings("unchecked")
return new SimpleNamingContext("", boundObjects, environment); public Context getInitialContext(Hashtable<?,?> environment) {
return new SimpleNamingContext("", boundObjects, (Hashtable<String, Object>) environment);
} }
}; };
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -115,7 +115,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
else { else {
// Create and activate new context builder. // Create and activate new context builder.
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
// The activate() call will cause an assigment to the activated variable. // The activate() call will cause an assignment to the activated variable.
builder.activate(); builder.activate();
} }
return activated; return activated;
@ -124,7 +124,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
private final Log logger = LogFactory.getLog(getClass()); private final Log logger = LogFactory.getLog(getClass());
private final Hashtable boundObjects = new Hashtable(); private final Hashtable<String,Object> boundObjects = new Hashtable<String,Object>();
/** /**
@ -156,7 +156,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
* Temporarily deactivate this context builder. It will remain registered with * Temporarily deactivate this context builder. It will remain registered with
* the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory * the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory
* (if configured) instead of exposing its own bound objects. * (if configured) instead of exposing its own bound objects.
* <p>Call <code>activate()</code> again in order to expose this contexz builder's own * <p>Call <code>activate()</code> again in order to expose this context builder's own
* bound objects again. Such activate/deactivate sequences can be applied any number * bound objects again. Such activate/deactivate sequences can be applied any number
* of times (e.g. within a larger integration test suite running in the same VM). * of times (e.g. within a larger integration test suite running in the same VM).
* @see #activate() * @see #activate()
@ -192,13 +192,13 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
* creating a new SimpleNamingContext instance. * creating a new SimpleNamingContext instance.
* @see SimpleNamingContext * @see SimpleNamingContext
*/ */
public InitialContextFactory createInitialContextFactory(Hashtable environment) { public InitialContextFactory createInitialContextFactory(Hashtable<?,?> environment) {
if (activated == null && environment != null) { if (activated == null && environment != null) {
Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY); Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY);
if (icf != null) { if (icf != null) {
Class icfClass = null; Class<?> icfClass = null;
if (icf instanceof Class) { if (icf instanceof Class) {
icfClass = (Class) icf; icfClass = (Class<?>) icf;
} }
else if (icf instanceof String) { else if (icf instanceof String) {
icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader()); icfClass = ClassUtils.resolveClassName((String) icf, getClass().getClassLoader());
@ -225,8 +225,9 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
// Default case... // Default case...
return new InitialContextFactory() { return new InitialContextFactory() {
public Context getInitialContext(Hashtable environment) { @SuppressWarnings("unchecked")
return new SimpleNamingContext("", boundObjects, environment); public Context getInitialContext(Hashtable<?,?> environment) {
return new SimpleNamingContext("", boundObjects, (Hashtable<String, Object>) environment);
} }
}; };
} }