1 23 package com.sun.appserv.management.util.jmx; 24 25 import java.util.Set ; 26 import java.util.Collections ; 27 28 import com.sun.appserv.management.util.misc.GSetUtil; 29 import com.sun.appserv.management.util.misc.GSetUtil; 30 31 34 public final class NoOpAttributeNameMapper implements AttributeNameMapper 35 { 36 final Set <String > mAttributeSet; 37 38 43 public 44 NoOpAttributeNameMapper( final String [] originalNames ) 45 { 46 mAttributeSet = GSetUtil.newStringSet( originalNames ); 47 } 48 49 50 public String 51 matchName( 52 final String derivedName, 53 final String [] candidates ) 54 { 55 throw new UnsupportedOperationException ( "matchName" ); 56 } 57 58 public void 59 dontMap( final String originalName ) 60 { 61 addMapping( originalName, originalName ); 62 } 63 64 public void 65 deriveAll( final String [] originalNames ) 66 { 67 GSetUtil.addArray( mAttributeSet, originalNames ); 68 } 69 70 public void 71 addMapping( 72 final String originalName, 73 final String derivedName ) 74 { 75 if ( ! originalName.equals( derivedName ) ) 76 { 77 throw new IllegalArgumentException ( derivedName ); 78 } 79 80 mAttributeSet.add( originalName ); 81 } 82 83 public boolean 84 requiresMapping( final String originalName ) 85 { 86 return( false ); 87 } 88 89 public String 90 originalToDerived( final String originalName ) 91 { 92 return( originalName ); 93 } 94 95 public String 96 derivedToOriginal( final String derivedName ) 97 { 98 return( derivedName ); 99 } 100 101 public Set <String > 102 getAttributeNames( ) 103 { 104 return( Collections.unmodifiableSet( mAttributeSet ) ); 105 } 106 } 107 | Popular Tags |