org.carrot2.util.simplexml.PersisterHelpers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of carrot2-mini Show documentation
Show all versions of carrot2-mini Show documentation
Carrot2 search results clustering framework. Minimal functional subset
(core algorithms and infrastructure, no document sources).
/*
* Carrot2 project.
*
* Copyright (C) 2002-2016, Dawid Weiss, Stanisław Osiński.
* All rights reserved.
*
* Refer to the full license file "carrot2.LICENSE"
* in the root folder of the repository checkout or at:
* http://www.carrot2.org/carrot2.LICENSE
*/
package org.carrot2.util.simplexml;
import java.io.*;
import java.util.Map;
import org.carrot2.util.CloseableUtils;
import org.carrot2.util.resource.IResource;
import org.carrot2.util.resource.ResourceLookup;
import org.simpleframework.xml.convert.AnnotationStrategy;
import org.simpleframework.xml.core.Persister;
import org.simpleframework.xml.strategy.Strategy;
import org.carrot2.shaded.guava.common.collect.ImmutableMap;
/**
* Simple XML session context helpers.
*/
public final class PersisterHelpers
{
/**
* Resource lookup key in the serialization/ deserialization session.
*/
private static final String RESOURCE_LOOKUP_KEY = ResourceLookup.class.getName();
/**
* Acquire {@link ResourceLookup} from a serialization/ deserialization session.
*/
public static ResourceLookup getResourceLookup(Map