001 /*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016 package org.opengion.fukurou.taglet;
017
018 /**
019 * 属æ?æƒ??を管ç?™ã‚‹ã?AttKeySet クラスã§ã™ã?
020 *
021 * @version 4.0
022 * @author Kazuhiko Hasegawa
023 * @since JDK5.0,
024 */
025 class AttKeySet {
026 private final String searchKey ;
027 private final int len ;
028 private final String seq ;
029 private final String valueName ;
030
031 /**
032 * コンストラクター
033 *
034 * @param searchKey String
035 * @param seq int
036 * @param valueName String
037 *
038 */
039 AttKeySet( final String searchKey,final int seq,final String valueName ) {
040 this.searchKey = searchKey ;
041 this.seq = String.valueOf( seq );
042 this.valueName = valueName ;
043
044 len = searchKey.length();
045 }
046
047 /**
048 * シーケンス番å·ã‚’è¿”ã—ã¾ã™ã?
049 *
050 * @return シーケンス番å·
051 *
052 */
053 String getSeq() {
054 return seq;
055 }
056
057 /**
058 * 属æ?åã‚’è¿”ã—ã¾ã™ã?
059 *
060 * @return 属æ?å?
061 *
062 */
063 String getValueName() {
064 return valueName;
065 }
066
067 /**
068 * クラスåã?å…ˆé?ä¸??ã®å ´åˆã?ã€?*** 部åˆ?‚’è¿”ã—ã¾ã™ã?
069 * インターフェースも扱ãˆã‚‹ã‚ˆã†ã«ä¿®æ£ã—ã¾ã—ãŸã®ã§ã€å?é ã?_ ã®å ´åˆã?ã€?
070 * _ を削除ã—ã¦è¿”ã—ã¾ã™ã?
071 *
072 * @param name クラスã®åç§°(例:DBCellEditor_**** , ViewForm_****)
073 */
074 String getAttKey( final String name ) {
075 String rtn = null; // ä¸??ã—ãªã‹ã£ãŸã?
076
077 if( name.equals( searchKey ) ) { // 完å?ä¸???šã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェース
078 return "(Interface)" + name ;
079 }
080
081 int start = name.indexOf( searchKey );
082 if( start == 0 ) { // å…ˆé?ä¸??ã—ãŸã€?
083 rtn = name.substring( len );
084 }
085
086 if( rtn != null && rtn.charAt(0) == '_' ) { return rtn.substring( 1 ); }
087 return rtn ;
088 }
089 }