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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:41:53+00:00 2026-06-13T21:41:53+00:00

Pretty straightforward question. I am using Jersey to build a REST system. If I

  • 0

Pretty straightforward question. I am using Jersey to build a REST system. If I have a class with a value that I need to use during processing but don’t want sent as part of the XML or JSON output when the class is marshaled, is there a way to ignore it? Something like:

@XmlRootElement(name="example")
class Example {
    private int a;
    private String b;
    private Object c;

    @XmlElement(ignore=true)
    public int getA() { return a; }
    @XmlElement
    public String getB() { return b; }
    @Ignore
    public Object getC() { return c; }
    ... //setters, constructors, etc.
}

I would hope that something like the ignore=true over getA() or the @Ignore over getC() would work, but i can find no documentation.

  • 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-13T21:41:54+00:00Added an answer on June 13, 2026 at 9:41 pm

    There are couple options depending on how many fields/properties you want to be ignored.

    Option #1 – @XmlTransient

    If you want less than half of the properties to be ignored then I would recommend annotating them with @XmlTransient. This will exclude them from the XML mapping.

    @XmlRootElement
    class Example {
        private int a;
        private String b;
        private Object c;
    
        @XmlTransient
        public int getA() { return a; } // UNMAPPED
    
        public String getB() { return b; } // MAPPED
    
        @XmlTransient    
        public Object getC() { return c; } // UNMAPPED
    
        ... //setters, constructors, etc.
    }
    

    Option #2 – @XmlAccessorType(XmlAccessType.NONE)

    If you want more than half of the properties ignored I would recommend using the @XmlAccessorType annotation at the type level to set XmlAccessType.NONE. This will cause only annotated properties to be mapped to XML.

    @XmlRootElement
    @XmlAccessorType(XmlAccessType.NONE)
    class Example {
        private int a;
        private String b;
        private Object c;
    
        public int getA() { return a; } // UNMAPPED
    
        @XmlElement
        public String getB() { return b; } // MAPPED
    
        public Object getC() { return c; } // UNMAPPED
    
        ... //setters, constructors, etc.
    }
    

    For More Information

    • http://blog.bdoughan.com/2012/04/jaxb-and-unmapped-properties.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be a pretty straightforward question. I have the following code, which forms
So pretty straightforward question. I have a c# .dll with a whole lot of
I have a pretty basic question that confuses me for some strange reason. I
Pretty straightforward question. Can it be done without the use of Ants or Maven?
My question is pretty straightforward: You are an executable file that outputs Access granted
I have a pretty straightforward question. Is it ok to store plugin DLLs in
I'm pretty sure this is a rather simple and straightforward question for anyone that
My question is pretty straightforward: can I do something like this? Say class foo
My question is pretty straightforward. How to create a transitional scroll which looks like
This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]

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.