From f9f7b5bc686218ff614bd35eaeefd8b179ded15e Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Wed, 26 Feb 2014 18:23:01 +0100 Subject: [PATCH] #?? - ObjectUtils now uses proxy target class for Advised proxies. --- .../springframework/hateoas/core/ObjectUtils.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/springframework/hateoas/core/ObjectUtils.java b/src/main/java/org/springframework/hateoas/core/ObjectUtils.java index 0ed3e5d5..0f53664e 100644 --- a/src/main/java/org/springframework/hateoas/core/ObjectUtils.java +++ b/src/main/java/org/springframework/hateoas/core/ObjectUtils.java @@ -15,6 +15,7 @@ */ package org.springframework.hateoas.core; +import org.springframework.aop.framework.Advised; import org.springframework.hateoas.Resource; /** @@ -41,6 +42,15 @@ public class ObjectUtils { } private static Class nullSafeType(Object object) { - return object == null ? null : object.getClass(); + + if (object == null) { + return null; + } + + if (object instanceof Advised) { + return ((Advised) object).getTargetClass(); + } + + return object.getClass(); } }