public static ServiceDef3 toServiceDef3(ServiceDef sd)
{
if (sd instanceof ServiceDef3)
return (ServiceDef3) sd;
final ServiceDef2 sd2 = toServiceDef2(sd);
return new ServiceDef3()
{
// ServiceDef3 methods:
public AnnotationProvider getClassAnnotationProvider()
{
return toAnnotationProvider(getServiceInterface());
}
public AnnotationProvider getMethodAnnotationProvider(final String methodName, final Class... argumentTypes)
{
return toAnnotationProvider(findMethod(getServiceInterface(), methodName, argumentTypes));
}
// ServiceDef2 methods:
public boolean isPreventDecoration()
{
return sd2.isPreventDecoration();
}
public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
{
return sd2.createServiceCreator(resources);
}
public String getServiceId()
{
return sd2.getServiceId();
}
public Set<Class> getMarkers()
{
return sd2.getMarkers();
}
public Class getServiceInterface()
{
return sd2.getServiceInterface();
}
public String getServiceScope()
{
return sd2.getServiceScope();
}
public boolean isEagerLoad()
{
return sd2.isEagerLoad();
}
};
}