// Path: 2-hi-spring-dynamic/src/main/java/com/helpinput/spring/support/ClassLoaderHolder.java
// public class ClassLoaderHolder {
// 	public static HiGroovyClassLoader gcl = new HiGroovyClassLoader();
// 	
// }
// 
// Path: 1-hi-utils/src/main/java/com/helpinput/core/LoggerBase.java
// public class LoggerBase {
// 	public static final Logger logger =LoggerFactory.getLogger(LoggerBase.class);
// }


import com.helpinput.core.LoggerBase;
import java.beans.PropertyEditorSupport;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import com.helpinput.annotation.TargetType;
import com.helpinput.spring.support.ClassLoaderHolder;
import org.slf4j.Logger;
/*
 * Copyright 2013-2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 *@Author: niaoge(Zhengsheng Xia)
 *@Email 78493244@qq.com
 *@Date: 2015-7-6
 */

package com.helpinput.propertyeditors;




@TargetType(Class.class)
public class GLClassEditor extends PropertyEditorSupport {
	static Logger logger = LoggerBase.logger;
	
	private final ClassLoader classLoader;
	
	public GLClassEditor() {
		this(null);
	}
	
	public GLClassEditor(ClassLoader classLoader) {
		this.classLoader = (classLoader != null ? classLoader : GLClassEditor.class.getClassLoader());
	}
	
	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		if (StringUtils.hasText(text)) {
			Class<?> result;
			try {
				result = ClassUtils.resolveClassName(text.trim(), this.classLoader);
			}
			catch (IllegalArgumentException e) {
				//for sessionFactory annotatedClasses
// Path: 2-hi-spring-dynamic/src/main/java/com/helpinput/spring/support/ClassLoaderHolder.java
// public class ClassLoaderHolder {
// 	public static HiGroovyClassLoader gcl = new HiGroovyClassLoader();
// 	
// }
// 
// Path: 1-hi-utils/src/main/java/com/helpinput/core/LoggerBase.java
// public class LoggerBase {
// 	public static final Logger logger =LoggerFactory.getLogger(LoggerBase.class);
// }


// Path: 2-hi-spring-dynamic/src/main/java/com/helpinput/propertyeditors/GLClassEditor.java
import com.helpinput.core.LoggerBase;
import java.beans.PropertyEditorSupport;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import com.helpinput.annotation.TargetType;
import com.helpinput.spring.support.ClassLoaderHolder;
import org.slf4j.Logger;

/*
 * Copyright 2013-2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 *@Author: niaoge(Zhengsheng Xia)
 *@Email 78493244@qq.com
 *@Date: 2015-7-6
 */

package com.helpinput.propertyeditors;




@TargetType(Class.class)
public class GLClassEditor extends PropertyEditorSupport {
	static Logger logger = LoggerBase.logger;
	
	private final ClassLoader classLoader;
	
	public GLClassEditor() {
		this(null);
	}
	
	public GLClassEditor(ClassLoader classLoader) {
		this.classLoader = (classLoader != null ? classLoader : GLClassEditor.class.getClassLoader());
	}
	
	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		if (StringUtils.hasText(text)) {
			Class<?> result;
			try {
				result = ClassUtils.resolveClassName(text.trim(), this.classLoader);
			}
			catch (IllegalArgumentException e) {
				//for sessionFactory annotatedClasses
				result = ClassUtils.resolveClassName(text.trim(), ClassLoaderHolder.gcl);