Java Code Examples for org.springframework.util.ObjectUtils#identityToString()

The following examples show how to use org.springframework.util.ObjectUtils#identityToString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRubyScriptUtils.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
	if (ReflectionUtils.isEqualsMethod(method)) {
		return (isProxyForSameRubyObject(args[0]));
	}
	else if (ReflectionUtils.isHashCodeMethod(method)) {
		return this.rubyObject.hashCode();
	}
	else if (ReflectionUtils.isToStringMethod(method)) {
		String toStringResult = this.rubyObject.toString();
		if (!StringUtils.hasText(toStringResult)) {
			toStringResult = ObjectUtils.identityToString(this.rubyObject);
		}
		return "JRuby object [" + toStringResult + "]";
	}
	try {
		IRubyObject[] rubyArgs = convertToRuby(args);
		IRubyObject rubyResult =
				this.rubyObject.callMethod(this.ruby.getCurrentContext(), method.getName(), rubyArgs);
		return convertFromRuby(rubyResult, method.getReturnType());
	}
	catch (RaiseException ex) {
		throw new JRubyExecutionException(ex);
	}
}
 
Example 2
Source File: JRubyScriptUtils.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
	if (ReflectionUtils.isEqualsMethod(method)) {
		return (isProxyForSameRubyObject(args[0]));
	}
	else if (ReflectionUtils.isHashCodeMethod(method)) {
		return this.rubyObject.hashCode();
	}
	else if (ReflectionUtils.isToStringMethod(method)) {
		String toStringResult = this.rubyObject.toString();
		if (!StringUtils.hasText(toStringResult)) {
			toStringResult = ObjectUtils.identityToString(this.rubyObject);
		}
		return "JRuby object [" + toStringResult + "]";
	}
	try {
		IRubyObject[] rubyArgs = convertToRuby(args);
		IRubyObject rubyResult =
				this.rubyObject.callMethod(this.ruby.getCurrentContext(), method.getName(), rubyArgs);
		return convertFromRuby(rubyResult, method.getReturnType());
	}
	catch (RaiseException ex) {
		throw new JRubyExecutionException(ex);
	}
}
 
Example 3
Source File: DefaultListableBeanFactory.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public String toString() {
	StringBuilder sb = new StringBuilder(ObjectUtils.identityToString(this));
	sb.append(": defining beans [");
	sb.append(StringUtils.collectionToCommaDelimitedString(this.beanDefinitionNames));
	sb.append("]; ");
	BeanFactory parent = getParentBeanFactory();
	if (parent == null) {
		sb.append("root of factory hierarchy");
	}
	else {
		sb.append("parent: ").append(ObjectUtils.identityToString(parent));
	}
	return sb.toString();
}
 
Example 4
Source File: DefaultListableBeanFactory.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public String toString() {
	StringBuilder sb = new StringBuilder(ObjectUtils.identityToString(this));
	sb.append(": defining beans [");
	sb.append(StringUtils.collectionToCommaDelimitedString(this.beanDefinitionNames));
	sb.append("]; ");
	BeanFactory parent = getParentBeanFactory();
	if (parent == null) {
		sb.append("root of factory hierarchy");
	}
	else {
		sb.append("parent: ").append(ObjectUtils.identityToString(parent));
	}
	return sb.toString();
}
 
Example 5
Source File: DefaultListableBeanFactory.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String toString() {
	StringBuilder sb = new StringBuilder(ObjectUtils.identityToString(this));
	sb.append(": defining beans [");
	sb.append(StringUtils.collectionToCommaDelimitedString(this.beanDefinitionNames));
	sb.append("]; ");
	BeanFactory parent = getParentBeanFactory();
	if (parent == null) {
		sb.append("root of factory hierarchy");
	}
	else {
		sb.append("parent: ").append(ObjectUtils.identityToString(parent));
	}
	return sb.toString();
}
 
Example 6
Source File: DefaultListableBeanFactory.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	StringBuilder sb = new StringBuilder(ObjectUtils.identityToString(this));
	sb.append(": defining beans [");
	sb.append(StringUtils.arrayToCommaDelimitedString(getBeanDefinitionNames()));
	sb.append("]; ");
	BeanFactory parent = getParentBeanFactory();
	if (parent == null) {
		sb.append("root of factory hierarchy");
	}
	else {
		sb.append("parent: ").append(ObjectUtils.identityToString(parent));
	}
	return sb.toString();
}
 
Example 7
Source File: DefaultListableBeanFactory.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	StringBuilder sb = new StringBuilder(ObjectUtils.identityToString(this));
	sb.append(": defining beans [");
	sb.append(StringUtils.collectionToCommaDelimitedString(this.beanDefinitionNames));
	sb.append("]; ");
	BeanFactory parent = getParentBeanFactory();
	if (parent == null) {
		sb.append("root of factory hierarchy");
	}
	else {
		sb.append("parent: ").append(ObjectUtils.identityToString(parent));
	}
	return sb.toString();
}
 
Example 8
Source File: DefaultListableBeanFactory.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public String toString() {
	StringBuilder sb = new StringBuilder(ObjectUtils.identityToString(this));
	sb.append(": defining beans [");
	sb.append(StringUtils.arrayToCommaDelimitedString(getBeanDefinitionNames()));
	sb.append("]; ");
	BeanFactory parent = getParentBeanFactory();
	if (parent == null) {
		sb.append("root of factory hierarchy");
	}
	else {
		sb.append("parent: ").append(ObjectUtils.identityToString(parent));
	}
	return sb.toString();
}
 
Example 9
Source File: DefaultSerializableObject.java    From jdal with Apache License 2.0 5 votes vote down vote up
public SerializedReference(Object obj) {
	this.id = ObjectUtils.identityToString(obj);
	serializedObjects.put(id, obj);
	
	if (log.isDebugEnabled())
		log.debug("Added new serialized reference. serialized objects size [" + serializedObjects.size() + "]");
}
 
Example 10
Source File: SerializableReference.java    From jdal with Apache License 2.0 5 votes vote down vote up
public void serialize() {
	if (useMemoryCache) {
		this.id = ObjectUtils.identityToString(target);
		serializedObjects.put(id, target);
		
		if (log.isDebugEnabled())
			log.debug("Added new serialized reference. serialized objects size [" + serializedObjects.size() + "]");
	}
}
 
Example 11
Source File: SingletonTargetSource.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public String toString() {
	return "SingletonTargetSource for target object [" + ObjectUtils.identityToString(this.target) + "]";
}
 
Example 12
Source File: SingletonTargetSource.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String toString() {
	return "SingletonTargetSource for target object [" + ObjectUtils.identityToString(this.target) + "]";
}