Example usage for com.fasterxml.jackson.annotation PropertyAccessor FIELD

List of usage examples for com.fasterxml.jackson.annotation PropertyAccessor FIELD

Introduction

In this page you can find the example usage for com.fasterxml.jackson.annotation PropertyAccessor FIELD.

Prototype

PropertyAccessor FIELD

To view the source code for com.fasterxml.jackson.annotation PropertyAccessor FIELD.

Click Source Link

Document

Field refers to fields of regular Java objects.

Usage

From source file:org.squbs.marshallers.json.JacksonMapperTest.java

@Test
public void marshalUnmarshalJavaBean() throws Exception {
    JacksonMapperSupport.register(TeamWithPrivateMembers.class,
            new ObjectMapper().setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY));
    HttpEntity entity = HttpEntities.create(ContentTypes.APPLICATION_JSON, fullTeamJson());
    RequestEntity content = mu.apply(marshaller(TeamWithPrivateMembers.class), fullTeamWithPrivateMembers())
            .toCompletableFuture().get();
    assertEquals(entity, content);//from  w  w w. j  a v  a2 s  . c  om
    TeamWithPrivateMembers teamBean = mu.apply(unmarshaller(TeamWithPrivateMembers.class), entity)
            .toCompletableFuture().get();
    assertEquals(fullTeamWithPrivateMembers(), teamBean);
}

From source file:org.squbs.marshallers.json.XLangJsonTest.java

@Test
public void marshalUnmarshalJavaBean() throws Exception {
    XLangJsonSupport.register(TeamWithPrivateMembers.class,
            new ObjectMapper().setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY));
    HttpEntity entity = HttpEntities.create(ContentTypes.APPLICATION_JSON, fullTeamJson());
    RequestEntity content = mu.apply(marshaller(TeamWithPrivateMembers.class), fullTeamWithPrivateMembers())
            .toCompletableFuture().get();
    assertEquals(entity, content);//ww  w  . j a  v  a 2  s  .c  om
    TeamWithPrivateMembers team = mu.apply(unmarshaller(TeamWithPrivateMembers.class), entity)
            .toCompletableFuture().get();
    assertEquals(fullTeamWithPrivateMembers(), team);
}

From source file:net.java.html.plotlyjs.Plotly.java

/**
 *
 * @param <CHART> a type of Chart, i.e. any type which extends {@link Charts}.
 * @param id the the DOM element id in your view which will contain your plot.
 * @param data a {@link PlotlyData} object representing
 * @param layout A {@link Layout} object. 
 * @param config Advanced Plotly configuration options in a {@link Config} object. the average Joe will probably not need this.  
 * @return a {@link Plotly} object representing this plot.
 * @throws PlotlyException/*from  w  w  w  . j  a v a  2 s  .c  om*/
 */
public static <CHART extends Charts> Plotly<CHART> newPlot(String id, PlotlyData<CHART> data, Layout layout,
        Config config) throws PlotlyException {
    try {
        Plotly.mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
        String strdata = Plotly.mapper.writeValueAsString(data.getTraces());
        String strlayout = Plotly.mapper.writeValueAsString(layout);
        JQuery.init();
        if (Plotly.jsElementExists(id)) {
            jsNewPlot(id, strdata, strlayout);
            return new Plotly<>(id, data, layout, config);
        } else {
            throw new PlotlyException("the specified DOM element does not exist.");
        }
    } catch (JsonProcessingException e) {
        throw new PlotlyException(e);
    }
}

From source file:net.java.html.plotlyjs.Plotly.java

/**
*
* @param <CHART> a type of Chart, i.e. any type which extends {@link Charts}.
* @param id the the DOM element id in your view which will contain your plot.
* @param data a {@link PlotlyData} object representing
* @param layout A {@link Layout} object. 
* @return/*from  w w  w. ja  v a2 s  . com*/
* @throws PlotlyException
*/
public static <CHART extends Charts> Plotly<CHART> newPlot(String id, PlotlyData<CHART> data, Layout layout)
        throws PlotlyException {
    try {
        Plotly.mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
        String strdata = Plotly.mapper.writeValueAsString(data.getTraces());
        String strlayout = Plotly.mapper.writeValueAsString(layout);
        Config defaultConfig = new Config.Builder().showLink(false).displaylogo(false)
                .modeBarButtonsToRemove(new String[] { "sendDataToCloud" }).build();
        String strconfig = Plotly.mapper.writeValueAsString(defaultConfig);
        jsNewPlot(id, strdata, strlayout, strconfig);

        Plotly<CHART> plt = new Plotly<>(id, data, layout, defaultConfig);

        plt.addKeyListeners();
        return plt;
    } catch (JsonProcessingException e) {
        throw new PlotlyException(e);
    }
}

From source file:org.whispersystems.textsecuregcm.WhisperServerService.java

@Override
public void run(WhisperServerConfiguration config, Environment environment) throws Exception {
    SharedMetricRegistries.add(Constants.METRICS_NAME, environment.metrics());
    environment.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    environment.getObjectMapper().setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
    environment.getObjectMapper().setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);

    DBIFactory dbiFactory = new DBIFactory();
    DBI database = dbiFactory.build(environment, config.getDataSourceFactory(), "accountdb");
    DBI messagedb = dbiFactory.build(environment, config.getMessageStoreConfiguration(), "messagedb");

    Accounts accounts = database.onDemand(Accounts.class);
    PendingAccounts pendingAccounts = database.onDemand(PendingAccounts.class);
    PendingDevices pendingDevices = database.onDemand(PendingDevices.class);
    Keys keys = database.onDemand(Keys.class);
    Messages messages = messagedb.onDemand(Messages.class);

    RedisClientFactory cacheClientFactory = new RedisClientFactory(config.getCacheConfiguration().getUrl());
    JedisPool cacheClient = cacheClientFactory.getRedisClientPool();
    JedisPool directoryClient = new RedisClientFactory(config.getDirectoryConfiguration().getUrl())
            .getRedisClientPool();//  www  .  j  av  a 2s.  c  om
    Client httpClient = initializeHttpClient(environment, config);

    DirectoryManager directory = new DirectoryManager(directoryClient);
    PendingAccountsManager pendingAccountsManager = new PendingAccountsManager(pendingAccounts, cacheClient);
    PendingDevicesManager pendingDevicesManager = new PendingDevicesManager(pendingDevices, cacheClient);
    AccountsManager accountsManager = new AccountsManager(accounts, directory, cacheClient);
    FederatedClientManager federatedClientManager = new FederatedClientManager(environment,
            config.getJerseyClientConfiguration(), config.getFederationConfiguration());
    MessagesManager messagesManager = new MessagesManager(messages);
    DeadLetterHandler deadLetterHandler = new DeadLetterHandler(messagesManager);
    DispatchManager dispatchManager = new DispatchManager(cacheClientFactory,
            Optional.<DispatchChannel>of(deadLetterHandler));
    PubSubManager pubSubManager = new PubSubManager(cacheClient, dispatchManager);
    PushServiceClient pushServiceClient = new PushServiceClient(httpClient, config.getPushConfiguration());
    WebsocketSender websocketSender = new WebsocketSender(messagesManager, pubSubManager);
    AccountAuthenticator deviceAuthenticator = new AccountAuthenticator(accountsManager);
    FederatedPeerAuthenticator federatedPeerAuthenticator = new FederatedPeerAuthenticator(
            config.getFederationConfiguration());
    RateLimiters rateLimiters = new RateLimiters(config.getLimitsConfiguration(), cacheClient);

    ApnFallbackManager apnFallbackManager = new ApnFallbackManager(pushServiceClient, pubSubManager);
    TwilioSmsSender twilioSmsSender = new TwilioSmsSender(config.getTwilioConfiguration());
    SmsSender smsSender = new SmsSender(twilioSmsSender);
    UrlSigner urlSigner = new UrlSigner(config.getS3Configuration());
    PushSender pushSender = new PushSender(apnFallbackManager, pushServiceClient, websocketSender,
            config.getPushConfiguration().getQueueSize());
    ReceiptSender receiptSender = new ReceiptSender(accountsManager, pushSender, federatedClientManager);
    FeedbackHandler feedbackHandler = new FeedbackHandler(pushServiceClient, accountsManager);
    TurnTokenGenerator turnTokenGenerator = new TurnTokenGenerator(config.getTurnConfiguration());
    Optional<byte[]> authorizationKey = config.getRedphoneConfiguration().getAuthorizationKey();

    environment.lifecycle().manage(apnFallbackManager);
    environment.lifecycle().manage(pubSubManager);
    environment.lifecycle().manage(feedbackHandler);
    environment.lifecycle().manage(pushSender);

    AttachmentController attachmentController = new AttachmentController(rateLimiters, federatedClientManager,
            urlSigner);
    KeysControllerV1 keysControllerV1 = new KeysControllerV1(rateLimiters, keys, accountsManager,
            federatedClientManager);
    KeysControllerV2 keysControllerV2 = new KeysControllerV2(rateLimiters, keys, accountsManager,
            federatedClientManager);
    MessageController messageController = new MessageController(rateLimiters, pushSender, receiptSender,
            accountsManager, messagesManager, federatedClientManager);

    environment.jersey().register(new AuthDynamicFeature(
            new BasicCredentialAuthFilter.Builder<Account>().setAuthenticator(deviceAuthenticator)
                    .setPrincipal(Account.class).buildAuthFilter(),
            new BasicCredentialAuthFilter.Builder<FederatedPeer>().setAuthenticator(federatedPeerAuthenticator)
                    .setPrincipal(FederatedPeer.class).buildAuthFilter()));
    environment.jersey().register(new AuthValueFactoryProvider.Binder());

    environment.jersey()
            .register(new AccountController(pendingAccountsManager, accountsManager, rateLimiters, smsSender,
                    messagesManager, new TimeProvider(), authorizationKey, turnTokenGenerator,
                    config.getTestDevices()));
    environment.jersey().register(
            new DeviceController(pendingDevicesManager, accountsManager, messagesManager, rateLimiters));
    environment.jersey().register(new DirectoryController(rateLimiters, directory));
    environment.jersey().register(new FederationControllerV1(accountsManager, attachmentController,
            messageController, keysControllerV1));
    environment.jersey().register(new FederationControllerV2(accountsManager, attachmentController,
            messageController, keysControllerV2));
    environment.jersey().register(new ReceiptController(receiptSender));
    environment.jersey().register(new ProvisioningController(rateLimiters, pushSender));
    environment.jersey().register(attachmentController);
    environment.jersey().register(keysControllerV1);
    environment.jersey().register(keysControllerV2);
    environment.jersey().register(messageController);

    if (config.getWebsocketConfiguration().isEnabled()) {
        WebSocketEnvironment webSocketEnvironment = new WebSocketEnvironment(environment, config, 90000);
        webSocketEnvironment.setAuthenticator(new WebSocketAccountAuthenticator(deviceAuthenticator));
        webSocketEnvironment.setConnectListener(new AuthenticatedConnectListener(accountsManager, pushSender,
                receiptSender, messagesManager, pubSubManager));
        webSocketEnvironment.jersey().register(new KeepAliveController(pubSubManager));
        webSocketEnvironment.jersey().register(messageController);

        WebSocketEnvironment provisioningEnvironment = new WebSocketEnvironment(environment, config);
        provisioningEnvironment.setConnectListener(new ProvisioningConnectListener(pubSubManager));
        provisioningEnvironment.jersey().register(new KeepAliveController(pubSubManager));

        WebSocketResourceProviderFactory webSocketServlet = new WebSocketResourceProviderFactory(
                webSocketEnvironment);
        WebSocketResourceProviderFactory provisioningServlet = new WebSocketResourceProviderFactory(
                provisioningEnvironment);

        ServletRegistration.Dynamic websocket = environment.servlets().addServlet("WebSocket",
                webSocketServlet);
        ServletRegistration.Dynamic provisioning = environment.servlets().addServlet("Provisioning",
                provisioningServlet);

        websocket.addMapping("/v1/websocket/");
        websocket.setAsyncSupported(true);

        provisioning.addMapping("/v1/websocket/provisioning/");
        provisioning.setAsyncSupported(true);

        webSocketServlet.start();
        provisioningServlet.start();

        FilterRegistration.Dynamic filter = environment.servlets().addFilter("CORS", CrossOriginFilter.class);
        filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
        filter.setInitParameter("allowedOrigins", "*");
        filter.setInitParameter("allowedHeaders",
                "Content-Type,Authorization,X-Requested-With,Content-Length,Accept,Origin,X-Signal-Agent");
        filter.setInitParameter("allowedMethods", "GET,PUT,POST,DELETE,OPTIONS");
        filter.setInitParameter("preflightMaxAge", "5184000");
        filter.setInitParameter("allowCredentials", "true");
    }

    environment.healthChecks().register("directory", new RedisHealthCheck(directoryClient));
    environment.healthChecks().register("cache", new RedisHealthCheck(cacheClient));

    environment.jersey().register(new IOExceptionMapper());
    environment.jersey().register(new RateLimitExceededExceptionMapper());
    environment.jersey().register(new InvalidWebsocketAddressExceptionMapper());
    environment.jersey().register(new DeviceLimitExceededExceptionMapper());

    environment.metrics().register(name(CpuUsageGauge.class, "cpu"), new CpuUsageGauge());
    environment.metrics().register(name(FreeMemoryGauge.class, "free_memory"), new FreeMemoryGauge());
    environment.metrics().register(name(NetworkSentGauge.class, "bytes_sent"), new NetworkSentGauge());
    environment.metrics().register(name(NetworkReceivedGauge.class, "bytes_received"),
            new NetworkReceivedGauge());
    environment.metrics().register(name(FileDescriptorGauge.class, "fd_count"), new FileDescriptorGauge());
}

From source file:de.ks.flatadocdb.index.GlobalIndex.java

protected ObjectMapper getMapper() {
    final ObjectMapper mapper = new ObjectMapper();
    mapper.findAndRegisterModules();/*from   w w  w  .java 2  s  .co m*/
    mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
    mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
    mapper.enableDefaultTyping();
    mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.WRAPPER_OBJECT);
    return mapper;
}

From source file:com.ikanow.aleph2.data_model.utils.TestBeanTemplateUtils.java

@Test
public void testNumberDeserializer() {
    TestDeserializeBean bean1 = BeanTemplateUtils
            .from("{\"testMap\":{\"test\":1.0}}", TestDeserializeBean.class).get();
    JsonNode jn1 = BeanTemplateUtils.toJson(bean1);

    assertEquals("{\"testMap\":{\"test\":1}}", jn1.toString());

    TestDeserializeBean bean2 = BeanTemplateUtils.from(
            "{\"testMap\":{\"test\":10000000000000,\"test1\":10000000000000.1,\"test2\":\"some string\"}}",
            TestDeserializeBean.class).get();
    JsonNode jn2 = BeanTemplateUtils.toJson(bean2);

    assertEquals(/*w  ww.  j a v a2  s  .com*/
            "{\"testMap\":{\"test\":10000000000000,\"test1\":1.00000000000001E13,\"test2\":\"some string\"}}",
            jn2.toString());

    TestDeserializeBean bean3 = BeanTemplateUtils
            .from("{\"testMap\":{\"test\":1e7, \"test2\":1.0000000000000E7,\"test3\":1E19}}",
                    TestDeserializeBean.class)
            .get();
    JsonNode jn3 = BeanTemplateUtils.toJson(bean3);

    assertEquals("{\"testMap\":{\"test\":10000000,\"test2\":1.0E7,\"test3\":1.0E19}}", jn3.toString());

    //Mapper without the Number deserializer to make sure the double values are staying the same
    ObjectMapper plainMapper = new ObjectMapper();
    plainMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
    plainMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
    plainMapper.setSerializationInclusion(Include.NON_NULL);

    //Checking that the deserializer doesn't break existing double values
    TestDeserializeBean bean4 = BeanTemplateUtils.from(
            "{\"testMap\":{\"test\":1e7, \"test2\":1.0000000000000E7,\"test3\":1.1,\"test4\":10000000000000.1,\"test4\":6e9,\"test5\":6e300,\"test5\":1E7 }}",
            TestDeserializeBean.class).get();
    JsonNode number_deserialized = BeanTemplateUtils.toJson(bean4);
    JsonNode plain = plainMapper.valueToTree(bean4);

    assertEquals(plain.toString(), number_deserialized.toString());

    // Just check it doesn't mess up actual double deserialization:

    TestDeserializeBean2 bean2_1 = BeanTemplateUtils
            .from("{\"testMap\":{\"test\":1.0}}", TestDeserializeBean2.class).get();
    JsonNode jn2_1 = BeanTemplateUtils.toJson(bean2_1);

    assertEquals("{\"testMap\":{\"test\":1.0}}", jn2_1.toString());

}

From source file:com.josue.tileset.editor.Editor.java

private void exportBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportBtnActionPerformed

    JFileChooser fileDialog = new JFileChooser();
    fileDialog.setFileFilter(new FileNameExtensionFilter("Json file", "json"));
    String outputFileName = inputFile.getAbsolutePath().split("\\.")[0] + ".json";
    fileDialog.setSelectedFile(new File(outputFileName));
    if (fileDialog.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {

        File file = fileDialog.getSelectedFile();
        ObjectMapper mapper = new ObjectMapper();
        mapper.setVisibility(PropertyAccessor.ALL, Visibility.NONE);
        mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
        try {/*from   w w  w .  ja va  2  s . c  o m*/
            mapper.writeValue(file, loadedTiles);
        } catch (IOException ex) {
            Logger.getLogger(Editor.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

From source file:com.ikanow.aleph2.data_model.utils.BeanTemplateUtils.java

/** Configures a mapper with the desired properties for use in Aleph2
 * @param configure_me - leave this empty to create a new mapper, or add one to configure an existing mapper
 * @return/* w w w  . j ava  2s . c o m*/
 */
public static ObjectMapper configureMapper(final Optional<ObjectMapper> configure_me) {
    final ObjectMapper mapper = configure_me.orElse(new ObjectMapper());
    mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
    mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
    mapper.setSerializationInclusion(Include.NON_NULL);
    mapper.setVisibility(PropertyAccessor.IS_GETTER, JsonAutoDetect.Visibility.NONE);

    final SimpleModule module = new SimpleModule();
    module.addDeserializer(Number.class, new NumberDeserializer());
    mapper.registerModule(module);

    return mapper;
}

From source file:org.apache.openaz.xacml.std.json.JSONRequest.java

/**
 * Read characters from the given <code>InputStream</code> and parse them into an XACML
 * {@link org.apache.openaz.xacml.api.Request} object.
 *
 * @param is/*from   w  ww.ja  va 2 s .  c om*/
 * @return
 * @throws JSONStructureException
 */
public static Request load(InputStream is) throws JSONStructureException {

    // TODO - ASSUME that order of members within an object does not matter (Different from XML, in JSON
    // everything is handled as Maps so order does not matter)

    // ensure shorthand map is set up
    if (shorthandMap == null) {
        initShorthandMap();
    }

    // ensure that we have an instance of the DataTypeFactory for generating AttributeValues by DataType
    if (dataTypeFactory == null) {
        try {
            dataTypeFactory = DataTypeFactory.newInstance();
            if (dataTypeFactory == null) {
                throw new NullPointerException("No DataTypeFactory found");
            }
        } catch (FactoryException e) {
            throw new JSONStructureException("Unable to find DataTypeFactory, e=" + e);
        }
    }

    // create a new Request object to be filled in
    StdMutableRequest stdMutableRequest = null;

    String json = null;
    ObjectMapper mapper = null;
    try {

        // read the inputStream into a buffer (trick found online scans entire input looking for
        // end-of-file)
        java.util.Scanner scanner = new java.util.Scanner(is);
        scanner.useDelimiter("\\A");
        json = scanner.hasNext() ? scanner.next() : "";
        scanner.close();

        mapper = new ObjectMapper().setVisibility(PropertyAccessor.FIELD, Visibility.ANY);

        // TODO - ASSUME that any duplicated component is a bad thing (probably indicating an error in the
        // incoming JSON)
        mapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);

        Map<?, ?> root = mapper.readValue(json, Map.class);

        //
        // Does the request exist?
        //
        Map<?, ?> jsonRequestMap = (Map<?, ?>) root.remove("Request");
        if (jsonRequestMap == null) {
            throw new JSONStructureException("No \"Request\" property found.");
        }

        checkUnknown("Top-level message", root);

        stdMutableRequest = new StdMutableRequest();

        //
        // Is there a Category?
        //
        Object categoryList = jsonRequestMap.remove("Category");
        if (categoryList != null && !(categoryList instanceof List)) {
            throw new JSONStructureException(
                    "Category must contain list of objects, not '" + categoryList.getClass() + "'");
        }
        if (categoryList != null) {
            //
            // Iterate each Category
            //
            Iterator<?> iter = ((List<?>) categoryList).iterator();
            while (iter.hasNext()) {
                Object category = iter.next();
                if (!(category instanceof Map)) {
                    throw new JSONStructureException(
                            "Category list must contain objects contained within curly braces ({})");
                }

                parseCategory((Map<?, ?>) category, "Category", null, stdMutableRequest);

            }
        }

        // The following may be either a single instance or an array. This allows multiple decisions to
        // work with the Default Category objects.
        // Example:
        // "AccessSubject" : [ {attributes group one},
        // {attributes group two}
        // ]

        //
        // Look for default Shorthand AccessSubject
        //
        parseDefaultCategory(jsonRequestMap, "AccessSubject",
                "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject", stdMutableRequest);
        //
        // Provide backward compatibility for our PEP's
        //
        parseDefaultCategory(jsonRequestMap, "Subject",
                "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject", stdMutableRequest);

        //
        // Look for default Shorthand Action
        //
        parseDefaultCategory(jsonRequestMap, "Action", "urn:oasis:names:tc:xacml:3.0:attribute-category:action",
                stdMutableRequest);

        //
        // Look for default Shorthand Resource
        //
        parseDefaultCategory(jsonRequestMap, "Resource",
                "urn:oasis:names:tc:xacml:3.0:attribute-category:resource", stdMutableRequest);

        //
        // Look for default Shorthand Environment
        //
        parseDefaultCategory(jsonRequestMap, "Environment",
                "urn:oasis:names:tc:xacml:3.0:attribute-category:environment", stdMutableRequest);

        //
        // Look for default Shorthand RecipientSubject
        //
        parseDefaultCategory(jsonRequestMap, "RecipientSubject",
                "urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject", stdMutableRequest);

        //
        // Look for default Shorthand IntermediarySubject
        //
        parseDefaultCategory(jsonRequestMap, "IntermediarySubject",
                "urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject", stdMutableRequest);

        //
        // Look for default Shorthand Codebase
        //
        parseDefaultCategory(jsonRequestMap, "Codebase",
                "urn:oasis:names:tc:xacml:1.0:subject-category:codebase", stdMutableRequest);

        //
        // Look for default Shorthand RequestingMachine
        //
        parseDefaultCategory(jsonRequestMap, "RequestingMachine",
                "urn:oasis:names:tc:xacml:1.0:subject-category:requesting-machine", stdMutableRequest);

        //
        // MultiRequest
        //
        Map<?, ?> multiRequests = (Map<?, ?>) jsonRequestMap.remove("MultiRequests");
        if (multiRequests != null) {
            if (!(multiRequests instanceof Map)) {
                throw new JSONStructureException("MultiRequests must be object structure, not single value");
            }

            List<?> requestReferenceList = (List<?>) multiRequests.remove("RequestReference");
            if (requestReferenceList == null) {
                throw new JSONStructureException("MultiRequest must contain a RequestReference element");
            }
            if (requestReferenceList.size() < 1) {
                throw new JSONStructureException(
                        "MultiRequest must contain at least one element in the RequestReference list");
            }

            checkUnknown("MultiRequest", multiRequests);

            for (Object requestReferenceMapObject : requestReferenceList) {
                if (!(requestReferenceMapObject instanceof Map)) {
                    throw new JSONStructureException("MultiRequest RequestReference must be object");
                }
                Map<?, ?> requestReferenceMap = (Map<?, ?>) requestReferenceMapObject;

                // each object within the list must contain a ReferenceId and only a ReferenceId
                Object referenceIdListObject = requestReferenceMap.remove("ReferenceId");
                if (referenceIdListObject == null) {
                    throw new JSONStructureException(
                            "MultiRequest RequestReference list element must contain ReferenceId");
                }
                List<?> referenceIdList = (List<?>) referenceIdListObject;
                if (referenceIdList.size() == 0) {
                    // the spec does not disallow empty list RequestReference objects
                    continue;
                }

                checkUnknown("RequestReference", requestReferenceMap);

                // create reference corresponding to RequestReference list element
                StdMutableRequestReference requestReference = new StdMutableRequestReference();

                for (Object referenceId : referenceIdList) {
                    // add attributes to the reference
                    // Since the order of the JSON is not constrained, we could process this section
                    // before the section containing attribute being referenced,
                    // so we cannot do a cross-check here to verify that the attribute reference exists.
                    // That will happen later when the PDP attempts to find the attribute.
                    StdRequestAttributesReference requestAttributesReference = new StdRequestAttributesReference(
                            (String) referenceId);
                    requestReference.add(requestAttributesReference);
                }
                stdMutableRequest.add(requestReference);
            }
        }

        //
        // ReturnPolicyIdList
        //
        // If omitted this is set to a default of false by the StdMutableRequest constructor.
        //
        Object returnPolicyIdList = jsonRequestMap.remove("ReturnPolicyIdList");
        Boolean returnPolicyIdListBoolean = makeBoolean(returnPolicyIdList, "ReturnPolicyIdList");
        if (returnPolicyIdList != null) {
            stdMutableRequest.setReturnPolicyIdList(returnPolicyIdListBoolean);
        }

        //
        // CombinedDecision
        //
        // If omitted this is set to a default of false by the StdMutableRequest constructor.
        //
        Object combinedDecision = jsonRequestMap.remove("CombinedDecision");
        Boolean combinedDecisionBoolean = makeBoolean(combinedDecision, "CombinedDecision");
        if (combinedDecision != null) {
            stdMutableRequest.setCombinedDecision(combinedDecisionBoolean);
        }

        //
        // XPath
        //

        // The JSON spec says that this has a default value, implying that if it is missing in the Request
        // we should fill it in.
        // However the XML (DOM) version does not do that. If the value is missing it leaves the
        // requestDefaults object blank.
        // We are following the XML approach and ignoring the Default value for this field in the spec.

        // TODO - Assume that no value for XPathVersion means "leave as null", not "fill in the default
        // value from spec. This violates the JSON spec
        Object xPath = jsonRequestMap.remove("XPathVersion");
        if (xPath != null) {
            // XPath is given in the JSON input
            if (!(xPath instanceof String)) {
                throw new JSONStructureException("XPathVersion not a URI passed as a String");
            }
            URI xPathUri = null;
            try {
                xPathUri = new URI(xPath.toString());
            } catch (Exception e) {
                throw new JSONStructureException("XPathVersion not a valid URI: '" + xPath + "'", e);
            }

            StdRequestDefaults requestDefaults = new StdRequestDefaults(xPathUri);
            stdMutableRequest.setRequestDefaults(requestDefaults);
        }

        checkUnknown("Request", jsonRequestMap);

    } catch (JsonParseException e) {
        // try to point to problem area in JSON input, if possible
        JsonLocation location = e.getLocation();
        String locationOfError = "(unavailable)";
        if (location != null && location != JsonLocation.NA) {
            String jsonText = json;
            if (location.getLineNr() > 1) {
                String[] jsonArray = jsonText.split("\\r?\\n|\\r");
                jsonText = jsonArray[location.getLineNr()];
            }
            if (location.getCharOffset() < jsonText.length()) {
                if (location.getCharOffset() > 0) {
                    locationOfError = jsonText.substring((int) location.getCharOffset() - 1);
                }
                if (locationOfError.length() > 30) {
                    locationOfError = locationOfError.substring(0, 30);
                }
            }
        }
        throw new JSONStructureException("Unable to parse JSON starting at text'" + locationOfError
                + "', input was '" + json + "', exception: " + e, e);
    } catch (JsonMappingException e) {
        throw new JSONStructureException("Unable to map JSON '" + json + "', exception: " + e, e);
    } catch (IOException e) {
        throw new JSONStructureException("Unable to read JSON input, exception: " + e, e);
    }

    // all done
    return new StdRequest(stdMutableRequest);
}