KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > orb > PrefixParserData


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
8 package com.sun.corba.se.impl.orb ;
9
10 import java.util.Properties JavaDoc ;
11
12 import com.sun.corba.se.spi.orb.StringPair ;
13 import com.sun.corba.se.spi.orb.Operation ;
14 import com.sun.corba.se.spi.orb.PropertyParser ;
15
16 public class PrefixParserData extends ParserDataBase {
17
18     private StringPair[] testData ;
19     private Class JavaDoc componentType ;
20
21     public PrefixParserData( String JavaDoc propertyName,
22     Operation operation, String JavaDoc fieldName, Object JavaDoc defaultValue,
23     Object JavaDoc testValue, StringPair[] testData, Class JavaDoc componentType )
24     {
25     super( propertyName, operation, fieldName, defaultValue, testValue ) ;
26     this.testData = testData ;
27     this.componentType = componentType ;
28     }
29
30     public void addToParser( PropertyParser parser )
31     {
32     parser.addPrefix( getPropertyName(), getOperation(), getFieldName(),
33         componentType ) ;
34     }
35
36     public void addToProperties( Properties JavaDoc props )
37     {
38     for (int ctr=0; ctr<testData.length; ctr++) {
39         StringPair sp = testData[ctr] ;
40
41         String JavaDoc propName = getPropertyName() ;
42         if (propName.charAt( propName.length() - 1 ) != '.')
43         propName += "." ;
44
45         props.setProperty( propName + sp.getFirst(), sp.getSecond() ) ;
46     }
47     }
48 }
49
Popular Tags