1. /*
  2. * @(#)PrefixParserData.java 1.7 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.orb ;
  8. import java.util.Properties ;
  9. import com.sun.corba.se.spi.orb.StringPair ;
  10. import com.sun.corba.se.spi.orb.Operation ;
  11. import com.sun.corba.se.spi.orb.PropertyParser ;
  12. public class PrefixParserData extends ParserDataBase {
  13. private StringPair[] testData ;
  14. private Class componentType ;
  15. public PrefixParserData( String propertyName,
  16. Operation operation, String fieldName, Object defaultValue,
  17. Object testValue, StringPair[] testData, Class componentType )
  18. {
  19. super( propertyName, operation, fieldName, defaultValue, testValue ) ;
  20. this.testData = testData ;
  21. this.componentType = componentType ;
  22. }
  23. public void addToParser( PropertyParser parser )
  24. {
  25. parser.addPrefix( getPropertyName(), getOperation(), getFieldName(),
  26. componentType ) ;
  27. }
  28. public void addToProperties( Properties props )
  29. {
  30. for (int ctr=0; ctr<testData.length; ctr++) {
  31. StringPair sp = testData[ctr] ;
  32. String propName = getPropertyName() ;
  33. if (propName.charAt( propName.length() - 1 ) != '.')
  34. propName += "." ;
  35. props.setProperty( propName + sp.getFirst(), sp.getSecond() ) ;
  36. }
  37. }
  38. }