Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow CastorMarshaller to accept more than one mapping file [SWS-88] #248

gregturn opened this issue Feb 1, 2007 · 1 comment

Allow CastorMarshaller to accept more than one mapping file [SWS-88] #248

gregturn opened this issue Feb 1, 2007 · 1 comment


Copy link

@gregturn gregturn commented Feb 1, 2007

Richard Gundersen opened SWS-88 and commented

Allow CastorMarshaller to accept multiple mapping files, as descibed here:

Castor can accept more than one by calling mapping.loadMapping() multiple times. I modified the code for my purposes like so:

private void createClassDescriptorResolver() throws MappingException, IOException {
    classDescriptorResolver = (XMLClassDescriptorResolver) ClassDescriptorResolverFactory
    if(!Utils.isEmpty(mappingLocations)) {
    	Mapping mapping = new Mapping();
    	for(int i=0; i<mappingLocations.size(); i++) {
    		logger.debug("Trying to load mapping resource: " + (String)mappingLocations.get(i));        		
    		Resource resource = new ClassPathResource((String)mappingLocations.get(i));                
            mapping.loadMapping(new InputSource(resource.getInputStream()));        		
        MappingUnmarshaller mappingUnmarshaller = new MappingUnmarshaller();
        MappingLoader mappingLoader = mappingUnmarshaller.getMappingLoader(mapping, BindingType.XML);
    else if (targetClass != null) {

(mappingLocations is now an ArrayList)

Configuration as follows:

<property name="mappingLocations">

Does this method need to be private by the way? Could it be protected, so it can be overridden?



Affects: 1.0 M3

1 votes, 0 watchers

Copy link
Member Author

@gregturn gregturn commented May 20, 2007

Arjen Poutsma commented

Closing RC1 issues.

@gregturn gregturn closed this May 20, 2007
@gregturn gregturn added this to the 1.0 RC1 milestone Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.