/*
 * 作成日: 2008/08/05
 * 著作権: Copyright (c) 2005 ZIGEN
 * ライセンス：Eclipse Public License - v 1.0
 * 原文：http://www.eclipse.org/legal/epl-v10.html
 */
package zigen.plugin.db.ext.s2jdbc.util;


public class CommentUtil {
	
	public static void main(String[] args) {
		
		System.out.println(getAnnotation("ManyToOne"));
		
		System.out.println(getAnnotation("@ManyToOne"));
		
		System.out.println(getAnnotation("hoge_hoge@ManyToOne"));
		

		System.out.println(removeAnnotation("hoge_hoge@ManyToOne"));
		System.out.println(removeAnnotation("hoge_hoge"));
		

	}
	
	
	public static String removeAnnotation(String remarks) {
		int st = remarks.indexOf('@');
		if (st > 0) {
			return remarks.substring(0, st).trim();
		} else {
			return remarks.trim();
		}
	}
	
	/**
	 * アノテーション部分だけを取得する
	 * 
	 * @param str
	 * @return
	 */
	public static String getAnnotation(String str) {
		int st = str.indexOf('@');
		if (st >= 0) {
			return str.substring(st).trim();
		} else {
			return null;
		}
	}
}
