Ok, so here's what I've come up with at this point:
if
(EC2ApiMetadata.CONTEXT_TOKEN.isAssignableFrom(context.getBackendType())) {
EC2Client ec2Client =
context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi();
turns into
if
(EC2ApiMetadata.contextToken(typeToken(EC2Client.class)).isAssignableFrom(context.getBackendType()))
{
EC2Client ec2Client =
context.unwrap(EC2ApiMetadata.contextToken(typeToken(EC2Client.class))).getApi();
...in 1.6.x, at least. In 1.7, the last line changes to
EC2Api ec2Api = context.unwrapApi(EC2Api.class);
So I guess we're stuck with that godawful amount of text for 1.6.x, and
slightly less for 1.7. It'd still be nice to have something like the old
CONTEXT_TOKEN for the de-async world, though.
A.
On Mon, Aug 5, 2013 at 10:15 AM, Andrew Bayer <[email protected]>wrote:
> Like the subject says - in Whirr, we've got a bunch of code like:
>
> GoogleComputeEngineApiMetadata.CONTEXT_TOKEN.isAssignableFrom(computeServiceContext.getBackendType())
>
> And I can't figure out how to translate that to the de-async world. Hints?
>
> A.
>