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.portal.lar.xstream;
016    
017    import com.liferay.portal.kernel.lar.xstream.XStreamConverter;
018    import com.liferay.portal.kernel.lar.xstream.XStreamUnmarshallingContext;
019    
020    import com.thoughtworks.xstream.converters.UnmarshallingContext;
021    
022    /**
023     * @author Daniel Kocsis
024     */
025    public class XStreamUnmarshallingContextAdapter
026            implements XStreamUnmarshallingContext {
027    
028            public XStreamUnmarshallingContextAdapter(
029                    UnmarshallingContext unmarshallingContext) {
030    
031                    _unmarshallingContext = unmarshallingContext;
032            }
033    
034            @Override
035            public void addCompletionCallback(Runnable work, int priority) {
036                    _unmarshallingContext.addCompletionCallback(work, priority);
037            }
038    
039            @Override
040            public Object convertAnother(Object object, Class<?> clazz) {
041                    return _unmarshallingContext.convertAnother(object, clazz);
042            }
043    
044            @Override
045            public Object convertAnother(
046                    Object object, Class<?> clazz, XStreamConverter xStreamConverter) {
047    
048                    return _unmarshallingContext.convertAnother(
049                            object, clazz, new ConverterAdapter(xStreamConverter));
050            }
051    
052            @Override
053            public Object currentObject() {
054                    return _unmarshallingContext.currentObject();
055            }
056    
057            @Override
058            public Object getRequiredType() {
059                    return _unmarshallingContext.getRequiredType();
060            }
061    
062            private final UnmarshallingContext _unmarshallingContext;
063    
064    }