1 23 24 29 30 package com.sun.enterprise.admin.dottedname; 31 32 import java.util.List ; 33 import com.sun.enterprise.admin.dottedname.valueaccessor.PrefixedValueSupport; 34 35 36 39 public final class DottedNameForValue 40 { 41 protected final DottedName mDottedName; 42 protected DottedName mPrefix; 43 protected String mValueName; 44 45 public 46 DottedNameForValue( final DottedName dottedName ) 47 { 48 mDottedName = dottedName; 49 mValueName = null; 50 mPrefix = init(); 51 } 52 53 57 private DottedName 58 init() 59 { 60 final List parts = mDottedName.getParts(); 61 final int numParts = parts.size(); 62 63 if ( numParts == 0 ) 67 { 68 final String msg = DottedNameStrings.getString( 69 DottedNameStrings.NO_VALUE_NAME_SPECIFIED_KEY ); 70 throw new IllegalArgumentException ( msg + " = " + mDottedName ); 71 } 72 73 final String lastPart = (String )parts.get( numParts - 1 ); 75 int numPrefixParts = 0; 76 77 PrefixedValueSupport prop_support = new PrefixedValueSupport(null); 80 final String dottedName = DottedName.toString(mDottedName.getDomain(), 81 mDottedName.getScope(), 82 mDottedName.getParts(), false); 83 final boolean isPrefixed = prop_support.isPrefixedValueDottedName(dottedName); 84 if ( isPrefixed ) 85 { 86 mValueName = prop_support.getPrefixedValueName(dottedName, true); 87 numPrefixParts = numParts - 2; 88 } 89 else 90 { 91 mValueName = lastPart; 93 numPrefixParts = numParts - 1; 94 } 95 96 return( DottedNameFactory.getInstance().get( DottedName.toString( mDottedName, numPrefixParts ) ) ); 97 } 98 99 public DottedName 100 getPrefix() 101 { 102 return( mPrefix ); 103 } 104 105 public String 106 getValueName() 107 { 108 assert( mValueName != null ); 109 return( mValueName ); 110 } 111 112 public String toString() { 113 return mDottedName.toString(); 114 } 115 } 116 117 118 | Popular Tags |