Interface design pattern / Java / Seam
Posted
by Walter White
on Stack Overflow
See other posts from Stack Overflow
or by Walter White
Published on 2010-04-28T02:10:11Z
Indexed on
2010/04/28
2:13 UTC
Read the original article
Hit count: 441
Hi all,
Is this possible somehow?
@Name("geolocationService")
public interface GeolocationService
{
@Query("SELECT g FROM Geolocation geolocation INNER JOIN geolocation.deployment deployment WHERE geolocation.ipStart <= INET_ATON(:ipAddress) AND deployment.active = TRUE")
Geolocation findByIpAddress(@NamedParameter("ipAddress")final String ipAddress);
}
public GeolocationAction
{
@In
private GeolocationService geolocationService;
@RequestParameter("ipAddress")
private String ipAddress;
@Out
private Geolocation geolocation;
public void find()
{
geolocation = geolocationService.findByIpAddress(ipAddress);
}
}
Is it possible to do this without implementing the interface? What is required to make that work? I want to maintain less and do more.
If I can intercept invocations of the geolocationService then I am golden, how would I do that? I don't want it to ever be instantiated, so it will always be null (I don't want the @Name and @In annotations either then).
Walter
© Stack Overflow or respective owner