Top Description Methods
org.springframework.jndi

public Interface JndiCallback<T>

Annotations
@FunctionalInterface
Type Parameters
<T>
the resulting object type
Imports
javax.naming.Context, .NamingException, org.springframework.lang.Nullable

Callback interface to be implemented by classes that need to perform an operation (such as a lookup) in a JNDI context. This callback approach is valuable in simplifying error handling, which is performed by the JndiTemplate class. This is a similar to JdbcTemplate's approach.

Note that there is hardly any need to implement this callback interface, as JndiTemplate provides all usual JNDI operations via convenience methods.

Author
Rod Johnson
See Also
JndiTemplate, org.springframework.jdbc.core.JdbcTemplate

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

a result object, or null
doInContext
(Context
the current JNDI context
ctx
)

Do something with the given JNDI context.

Method Detail

doInContextback to summary
public T doInContext(Context ctx) throws NamingException

Do something with the given JNDI context.

Implementations don't need to worry about error handling or cleanup, as the JndiTemplate class will handle this.

Parameters
ctx:Context

the current JNDI context

Returns:T

a result object, or null

Annotations
@Nullable
Exceptions
NamingException:
if thrown by JNDI methods