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

  • Home
  • SEARCH
  • 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 5993169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:38:11+00:00 2026-05-22T23:38:11+00:00

Hey folks, hopefully a nice easy one here. I’m generating classes with JAXB from

  • 0

Hey folks, hopefully a nice easy one here.

I’m generating classes with JAXB from a schema, and I’d like to be able to process them with a Visitor pattern.

To do that, I think I need every JAXB-generated class to implement the interface I’ve defined, and add a very simple method to them, so a simple example would be:

Default class:

public class MyClass {
   private String name;

   public void get/setName() {...}
}

Desired class:

public class MyClass implements MyVisitorNode {
  private String name;

  public void get/setName() {...}

  public void accept(MyVisitorVisitor visitor) {
    visitor.visit(this);
  }
}

Is this possible, and if it is, what are the options? (Change the schema, runtime bytecode manipulation, manipulate the JAXBContext somehow…)

Ideally, without relying on vendor-specific extensions.

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-22T23:38:12+00:00Added an answer on May 22, 2026 at 11:38 pm

    The xjc compiler for JAXB has a plugin interface that allows developers to create plugins that modify the generated code. My personal favorite is the fluent-api but there are others to add toString, equals, hashCode, etc.

    I created a plugin using this technology to implement the visitor pattern and made it available as a google code project. It may not be exactly what you’re looking for but it might be a good place to start to review the code and tests if you need to modify it to suit your needs.

    http://code.google.com/p/jaxb-visitor/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey folks - I'm writing a pretty simple iPhone application. The data comes from
Hey Folks,I have pasted my code here. Dialog.inform contains a 'long' value which is
Hey folks, I have the following piece of code from C++. for (int i=0;
Hey folks, I've migrated a site from WordPress to a new CMS, and I
Hey folks, I have to apologize for my inexperience here, I've been working on
Hey folks, I got a project from a firm program out a Wordpress design.
Problem Hey folks. I'm looking for some advice on python performance. Some background on
Hey folks. I'm looking for the best way to do something simple in symfony.
Hey folks, every once in a while I have the need to automate data
Hey folks, ok so this is my problem, I need to display HTML code

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.