@Override
    public void apply(final ApiRequest request, final IPolicyContext context, final Object config,
            final IPolicyChain<ApiRequest> chain) {
        final ISharedStateComponent sharedState = context.getComponent(ISharedStateComponent.class);
        final String namespace = "urn:" + getClass().getName();
        final String propName = "bean-property";
        DataBean db = new DataBean();
        db.setProperty1("my-value");
        db.setProperty2(true);
        db.setProperty3(42);
        sharedState.setProperty(namespace, propName, db, new IAsyncResultHandler<Void>() {
            @Override
            public void handle(IAsyncResult<Void> result) {
                chain.doApply(request);
            }
        });
    }
@see io.apiman.gateway.engine.policy.IPolicy#apply(io.apiman.gateway.engine.beans.ApiRequest, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.policy.IPolicyChain)
gateway/test/src/test/java/io/apiman/gateway/test/policies/BeanSharedStatePolicy.java