KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > trading > util > PropUtil


1
2 // Copyright (C) 1998-1999
3
// Object Oriented Concepts, Inc.
4

5 // **********************************************************************
6
//
7
// Copyright (c) 1997
8
// Mark Spruiell (mark@intellisoft.com)
9
//
10
// See the COPYING file for more information
11
//
12
// **********************************************************************
13

14 package org.jacorb.trading.util;
15
16 import org.omg.CORBA.*;
17 import org.omg.CosTrading.*;
18 import org.omg.CosTradingDynamic.*;
19
20 public class PropUtil
21 {
22     private PropUtil()
23     {
24     }
25
26
27     public static Any getPropertyValue(Property prop)
28     {
29     Any result = null;
30
31     if (isDynamicProperty(prop.value.type())) {
32
33         try {
34         DynamicProp dp = DynamicPropHelper.extract(prop.value);
35
36         // evaluate dynamic property
37
result = dp.eval_if.evalDP(prop.name, dp.returned_type, dp.extra_info);
38         }
39         catch (DPEvalFailure e) {
40         // ignore
41
}
42         catch (org.omg.CORBA.SystemException JavaDoc e) {
43         // ignore
44
}
45         catch (java.lang.NullPointerException JavaDoc e) {
46         // ignore. Is this really correct?
47
}
48     }
49     else
50         result = prop.value;
51
52     return result;
53     }
54
55
56     public static boolean hasDynamicProperties(Property[] props)
57     {
58     boolean result = false;
59
60     for (int i = 0; i < props.length && ! result; i++)
61         result = isDynamicProperty(props[i].value.type());
62
63     return result;
64     }
65
66
67     public static boolean isDynamicProperty(TypeCode tc)
68     {
69     boolean result = false;
70     result = tc.equal(DynamicPropHelper.type());
71
72     return result;
73     }
74 }
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Popular Tags