List of usage examples for org.springframework.util ObjectUtils getIdentityHexString
public static String getIdentityHexString(Object obj)
From source file:org.springmodules.cache.interceptor.caching.NullObject.java
public String toString() { String identity = ObjectUtils.getIdentityHexString(this); return getClass().getName() + "@" + identity; }
From source file:com.autentia.wuija.widget.JsfWidget.java
public JsfWidget() { id = "id" + ObjectUtils.getIdentityHexString(this); }
From source file:org.cloudfoundry.tools.io.ResourceURL.java
/** * Get a URL for the given {@link Resource}. * //from w ww . ja v a 2 s . c o m * @param resource the resource * @param nonLocking if the URL should protect against file locking * @return a URL for the resource * @throws MalformedURLException */ public static URL get(Resource resource, boolean nonLocking) throws MalformedURLException { // zipped resource cannot be handled by URLClassLoader, make it look like a folder if (resource instanceof File && ZIPPED_RESOURCES.match(null, resource)) { resource = new ZipArchive((File) resource); } ResourceURLStreamHandler handler = new ResourceURLStreamHandler(resource, nonLocking); return new URL(PROTOCOL, resource.getClass().getName() + "@" + ObjectUtils.getIdentityHexString(resource), 0, resource.toString(), handler); }
From source file:com.griddynamics.banshun.xml.ExportBeanDefinitionParser.java
@Override protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) { return element.getAttribute(REF_ATTR) + "$export" + BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR + ObjectUtils.getIdentityHexString(definition); }
From source file:org.cloudfoundry.identity.uaa.config.NestedMapPropertySource.java
private void appendCache(Map<String, Object> output, Set<String> seen, Map<String, Object> input, String path) { synchronized (this.cache) { seen.add(ObjectUtils.getIdentityHexString(input)); for (Entry<String, Object> entry : input.entrySet()) { String key = entry.getKey(); if (StringUtils.hasText(path)) { if (key.startsWith("[")) { key = path + key;/*from w ww . j a va2 s . com*/ } else { key = path + "." + key; } } Object value = entry.getValue(); if (value instanceof String) { output.put(key, value); } else if (value instanceof Map) { // Need a compound key @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) value; output.put(key, map); if (!seen.contains(ObjectUtils.getIdentityHexString(map))) { appendCache(output, seen, map, key); } } else if (value instanceof Collection) { // Need a compound key @SuppressWarnings("unchecked") Collection<Object> collection = (Collection<Object>) value; output.put(key, collection); int count = 0; for (Object object : collection) { String index = "[" + (count++) + "]"; if (!seen.contains(ObjectUtils.getIdentityHexString(object))) { appendCache(output, seen, Collections.singletonMap(index, object), key); } else { output.put(key + index, object); } } } else { output.put(key, value); } } } }
From source file:com.griddynamics.banshun.config.xml.ExportBeanDefinitionParser.java
@Override protected String resolveId(Element el, AbstractBeanDefinition definition, ParserContext parserContext) { return el.getAttribute(REF_ATTR) + "$export" + BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR + ObjectUtils.getIdentityHexString(definition); }
From source file:org.springmodules.util.ObjectsTests.java
/** * Verifies that the method//from ww w .ja v a 2 s. co m * <code>{@link Objects#identityToString(Object)}</code> returns a * <code>StringBuffer</code> containing the class name of the given object, * the "@" symbol and the hex string form of the object's identity hash code. */ public void testIdentityToString() { Object obj = new Object(); StringBuffer expected = new StringBuffer(obj.getClass().getName()); expected.append("@" + ObjectUtils.getIdentityHexString(obj)); StringBuffer actual = Objects.identityToString(obj); assertEquals(expected.toString(), actual.toString()); }
From source file:org.springmodules.cache.serializable.ObjectWrapperTests.java
public void testToStringWithValueBeingString() { wrapper.setValue("C-3PO"); String actual = wrapper.getClass().getName() + "@" + ObjectUtils.getIdentityHexString(wrapper) + "[value='C-3PO']"; assertEquals(wrapper.toString(), actual); }
From source file:org.springmodules.cache.interceptor.caching.CachedTests.java
public void testToString() { attribute.setModelId("main"); String actual = attribute.getClass().getName() + "@" + ObjectUtils.getIdentityHexString(attribute) + "[modelId='main']"; assertEquals(attribute.toString(), actual); }
From source file:org.springmodules.cache.provider.ehcache.EhCacheCachingModelTests.java
public void testToStringWithCacheNameEqualToNull() { model.setCacheName(null);//from www.jav a 2 s . co m String actual = model.getClass().getName() + "@" + ObjectUtils.getIdentityHexString(model) + "[cacheName=null, blocking=false, cacheEntryFactory=null]"; assertEquals(model.toString(), actual); }