Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6607695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:31:51+00:00 2026-05-25T19:31:51+00:00

I have a Java object, and in it exists a spatial shape defined by

  • 0

I have a Java object, and in it exists a spatial shape defined by a String of “well-known text”. On mouseover of this object in my GWT UI, my code passes this String to Javascript through JSNI, which in turn does a bunch of parsing and creates appropriate Bing Maps API shapes.

A simplified example of this would be a map application where each state exists as an object containing the states name and a string defining its perimeter. On mouseover of the states name in my UI, the perimeter string is parsed and a representative shape drawn on the map.

So right now, my code does the passing, parsing, and creating every time the user mouses-over my object. I’m looking for a way to parse the strings and create the objects only once each, hopefully storing the full, already created Javascript objects (Bing Maps shapes) in the original Java objects themselves. This, I think, should surely speed things up – the UI starts to look laggy when it has to parse and create several very detailed map objects every time the user moves the mouse to a different item.

Is it possible to store Javascript objects of this nature in my Java objects, and then bring them back to Javascript whenever I need them?

In my Java code (GWT), I can create a JavascriptObject, but is this sufficient for holding something like a Microsoft.Maps.Polygon object?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:31:51+00:00Added an answer on May 25, 2026 at 7:31 pm

    Why not just cache them in javascript? Once you’ve created an object in the Javascript, store it in a cache object with the string as the key. Then, whenever you get a request for a new object, you check the cache and use the pre-created one if there is one. If there isn’t a pre-created one, you create it and add it to the cache.

    If you want to pre-create a number of objects, you could have the java just call the javascript with a bunch of strings for which it would pre-populate the cache with. This keeps all the Javascript objects on the Javascript side of the fence and all the Java objects on their site of the fence, yet should still help with the performance.

    This is the general idea in pseudo-code:

    var cache = {};
    
    function createJSObject(stringArgument) {
        if (stringArgument in cache) {
            return(cache[stringArgument]);
        }
        var obj;
    
        // create the object here
        // ...
    
        // cache the object we created
        cache[stringArgument] = obj;
        return(obj);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DSL Java object, i.e. a POJO which returns this in setters
I have a Java Properties object that I load from an in-memory String ,
Suppose you have a java object, would it be possible to detect where exists
I have a Java object which is able to configure itself given an XML
If you have a Java object and an XML schema (XSD), what is the
I have a java.sql.ResultSet object containg data from a query that was run. How
If you have a java.io.InputStream object, how should you process that object and produce
Let's say I have a java.util.Properties object. The Properties object has a method called
I have a MATLAB class which contains a reference to a java object classdef
On a JSTL/JSP page, I have a java.util.Date object from my application. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.