001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.exportimport.xstream;
016    
017    import com.thoughtworks.xstream.converters.UnmarshallingContext;
018    
019    /**
020     * @author Daniel Kocsis
021     */
022    public class XStreamUnmarshallingContextAdapter
023            implements XStreamUnmarshallingContext {
024    
025            public XStreamUnmarshallingContextAdapter(
026                    UnmarshallingContext unmarshallingContext) {
027    
028                    _unmarshallingContext = unmarshallingContext;
029            }
030    
031            @Override
032            public void addCompletionCallback(Runnable work, int priority) {
033                    _unmarshallingContext.addCompletionCallback(work, priority);
034            }
035    
036            @Override
037            public Object convertAnother(Object object, Class<?> clazz) {
038                    return _unmarshallingContext.convertAnother(object, clazz);
039            }
040    
041            @Override
042            public Object convertAnother(
043                    Object object, Class<?> clazz, XStreamConverter xStreamConverter) {
044    
045                    return _unmarshallingContext.convertAnother(
046                            object, clazz, new ConverterAdapter(xStreamConverter));
047            }
048    
049            @Override
050            public Object currentObject() {
051                    return _unmarshallingContext.currentObject();
052            }
053    
054            @Override
055            public Object getRequiredType() {
056                    return _unmarshallingContext.getRequiredType();
057            }
058    
059            private final UnmarshallingContext _unmarshallingContext;
060    
061    }