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 7938761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:53:57+00:00 2026-06-03T22:53:57+00:00

I am using an abstract class to localize my models to different languages. This

  • 0

I am using an abstract class to localize my models to different languages. This is the inheritance chain that I have set up:

//Base model, contains localized fields
public class Restaurant extends LocalizedModel<LocalizedRestaurantData>{

...

}

//Abstract class to support localized fields for all my models
@XmlRootElement
public abstract class LocalizedModel<T extends LocalizedData> {

    private T en;

    public T getEn() {
        return en;
    }
    public void setEn(T en) {
        this.en = en;
    }
    ...
}

//Implementation of the localized fields for the restaurant class.
@XmlRootElement
public class LocalizedRestaurantData extends LocalizedData{

    protected String name;
    protected String address;
    ...
}

This all works fine in my Jersey JSON web service, except for one thing: All the instances of the localized property en contain an extra field type:

Restaurant JSON:

{
"en": {
        "type": "localizedRestaurantData",
        "address": "1234 Main St.",
        "name": "Tacos Folie"
    },
 ...
}

This type field is undesired and undesirable especially since it seems to be also required by Jackson when parsing an object. I’ve added @JsonIgnoreProperties({"type"}) in my code without success.

  • 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-06-03T22:53:59+00:00Added an answer on June 3, 2026 at 10:53 pm

    After multiple attempts and soliciting help on both the Jackson and the Jersey mailing list, the solution I found is:

    My JERSEY context was implementing ContextResolver<JSONJAXBContext>. That needs to be changed to ContextResolver<JacksonJsonProvider> to use the pure JSON parser.

    Secondly, the JacksonJsonProvider needs to configured as follows:

    JacksonJsonProvider jjp = new JacksonJsonProvider();
    jjp.configure(Feature.WRITE_NULL_MAP_VALUES, false);
    jjp.configure(Feature.WRITE_NULL_PROPERTIES, false);
    

    And used as the context.

    Finally, the following method needs to be overriden as follows in the ContextResolver:

    @Override
        public Set<Object> getSingletons() {
          Set<Object> s = new HashSet<Object>();
          JacksonJsonProvider jjp = new JacksonJsonProvider();
          jjp.configure(Feature.WRITE_NULL_MAP_VALUES, false);
          jjp.configure(Feature.WRITE_NULL_PROPERTIES, false);
          s.add(jjp);
          return s;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple scenario, using NHibernate: one abstract base class animal; two
I have an application that allows, using an abstract class, people to write their
In my application I have a mapping like this @MappedSuperclass public abstract class Base
In a design of a class hierarchy, I'm using an abstract base class that
I have an existing Django project that has several models using concrete inheritance of
I have got an abstract base class and inherited poco entities. I am using
I am using Django models abstract base class to generate my website menus from
I'm trying to implement an identity map using generics. I have an abstract class,
I have a simple Poco-Model using abstract classes, and it seems not to work
I have an abstract class BaseItem declared like this: public abstract class BaseItem {

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.