1 18 package org.apache.beehive.netui.pageflow.scoping.internal; 19 20 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils; 21 22 23 27 public class ScopedAttributeContainer extends AttributeContainer 28 { 29 private Object _scopeKey; 30 31 public ScopedAttributeContainer( Object scopeKey ) 32 { 33 _scopeKey = scopeKey; 34 } 35 36 public final String getScopedName( String baseName ) 37 { 38 return ScopedServletUtils.getScopedName( baseName, _scopeKey ); 39 } 40 41 public boolean isInScope( String keyName ) 42 { 43 return isInScope( keyName, _scopeKey ); 44 } 45 46 public static boolean isInScope( String keyName, Object scopeKey ) 47 { 48 return keyName.startsWith( scopeKey.toString() ); 49 } 50 51 public String removeScope( String keyName ) 52 { 53 return removeScope( keyName, _scopeKey ); 54 } 55 56 public static String removeScope( String keyName, Object scopeKey ) 57 { 58 assert keyName.startsWith( scopeKey.toString() ) : keyName; 59 return keyName.substring( scopeKey.toString().length() ); 60 } 61 62 public final Object getScopeKey() 63 { 64 return _scopeKey; 65 } 66 67 public void renameScope( Object newScopeKey ) 68 { 69 _scopeKey = newScopeKey; 70 } 71 } 72 | Popular Tags |