reattachvisitor.java

来自「用Java实现的23个常用设计模式源代码」· Java 代码 · 共 43 行

JAVA
43
字号
//$Id: ReattachVisitor.java,v 1.1.2.6 2003/11/27 16:09:59 oneovthafew Exp $
package net.sf.hibernate.impl;

import java.io.Serializable;

import net.sf.hibernate.HibernateException;
import net.sf.hibernate.type.AbstractComponentType;
import net.sf.hibernate.type.Type;

/**
 * Abstract superclass of visitors that reattach collections
 * @author Gavin King
 */
abstract class ReattachVisitor extends ProxyVisitor {

	private final Serializable key;
	
	final Serializable getKey() {
		return key;
	}
	
	public ReattachVisitor(SessionImpl session, Serializable key) {
		super(session);
		this.key=key;
	}

	Object processComponent(Object component, AbstractComponentType componentType)
	throws HibernateException {
		
		Type[] types = componentType.getSubtypes();
		if (component==null) {
			processValues( new Object[types.length], types );
		}
		else {
			super.processComponent(component, componentType);
			//processValues( componentType.getPropertyValues( component, getSession() ), types );
		}
		
		return null;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?