1
|
/**
|
2
|
* Copyright (C) 2009 EDIT European Distributed Institute of Taxonomy
|
3
|
* http://www.e-taxonomy.eu
|
4
|
*
|
5
|
* The contents of this file are subject to the Mozilla Public License Version
|
6
|
* 1.1 See LICENSE.TXT at the top of this package for the full license terms.
|
7
|
*/
|
8
|
|
9
|
package eu.etaxonomy.cdm.remote.json.processor.matcher;
|
10
|
|
11
|
import java.util.Set;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
import org.hibernate.proxy.HibernateProxy;
|
15
|
|
16
|
import net.sf.json.processors.JsonBeanProcessorMatcher;
|
17
|
|
18
|
/**
|
19
|
* @author a.kohlbecker
|
20
|
*
|
21
|
*/
|
22
|
public class HibernateProxyBeanProcessorMatcher extends
|
23
|
JsonBeanProcessorMatcher {
|
24
|
|
25
|
public static final Logger logger = Logger.getLogger(HibernateProxyBeanProcessorMatcher.class);
|
26
|
|
27
|
/* (non-Javadoc)
|
28
|
* @see net.sf.json.processors.JsonBeanProcessorMatcher#getMatch(java.lang.Class, java.util.Set)
|
29
|
*/
|
30
|
@Override
|
31
|
public Object getMatch(Class target, Set set) {
|
32
|
|
33
|
if (HibernateProxy.class.isAssignableFrom(target)) {
|
34
|
logger.debug("Found HibernateProxy object of class " + target.getClass() + " returning " + HibernateProxy.class);
|
35
|
return HibernateProxy.class;
|
36
|
}
|
37
|
|
38
|
return DEFAULT.getMatch(target, set);
|
39
|
}
|
40
|
|
41
|
}
|