xref: /AOO41X/main/ridljar/com/sun/star/lib/uno/typeinfo/ParameterTypeInfo.java (revision a046d00f64f7897a53f3356d02ce7dd043873852)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 package com.sun.star.lib.uno.typeinfo;
24 
25 import com.sun.star.uno.Type;
26 
27 public class ParameterTypeInfo extends TypeInfo
28 {
29     protected int       m_index;
30     protected String    m_methodName;
31     private final Type m_unoType; // @since UDK 3.2
32 
33     /**
34        Create a parameter type info with a UNO type that cannot unambiguously be
35        represented as a Java 1.2 type.
36 
37        @param name the name of this parameter; must not be <code>null</code>
38 
39        @param methodName the name of the method; must not be <code>null</code>
40 
41        @param index the index among the parameters
42 
43        @param flags any flags (<code>IN</code>, <code>OUT</code>,
44        <code>UNSIGNED</code>, <code>ANY</code>, <code>INTERFACE</code>)
45 
46        @param unoType the exact UNO type; or <code>null</code> if the UNO type
47        is already unambiguously represented by the Java&nbsp;1.2 type
48 
49        @since UDK 3.2
50      */
ParameterTypeInfo( String name, String methodName, int index, int flags, Type unoType)51     public ParameterTypeInfo(
52         String name, String methodName, int index, int flags, Type unoType)
53     {
54         super(name, flags);
55         m_index = index;
56         m_methodName = methodName;
57         m_unoType = unoType;
58     }
59 
ParameterTypeInfo(String name, String methodName, int index, int flags)60     public ParameterTypeInfo(String name, String methodName, int index, int flags)
61     {
62         this(name, methodName, index, flags, null);
63     }
64 
getMethodName()65     public String getMethodName()
66     {
67         return m_methodName;
68     }
69 
getIndex()70     public int getIndex()
71     {
72         return m_index;
73     }
74 
isIN()75     public boolean isIN()
76     {
77         return ((m_flags & TypeInfo.IN) != 0 ||
78                 (m_flags & (TypeInfo.IN | TypeInfo.OUT)) == 0); // nothing set => IN
79     }
80 
isOUT()81     public boolean isOUT()
82     {
83         return (m_flags & TypeInfo.OUT) != 0;
84     }
85 
isINOUT()86     public boolean isINOUT()
87     {
88         return (m_flags & (TypeInfo.IN | TypeInfo.OUT)) == (TypeInfo.IN | TypeInfo.OUT);
89     }
90 
91     /**
92        Get the exact UNO type of this parameter type info, in case it cannot
93        unambiguously be represented as a Java&nbsp;1.2 type.
94 
95        <p>If this is an out or in&ndash;out parameter, the UNO type must be a
96        sequence type, taking into account that such a parameter is represented
97        in Java as a parameter of array type.</p>
98 
99        @return the exact UNO type of this parameter type info, or
100        <code>null</code> if the UNO type is already unambiguously represented by
101        the Java&nbsp;1.2 type
102 
103        @since UDK 3.2
104      */
getUnoType()105     public final Type getUnoType() {
106         return m_unoType;
107     }
108 }
109 
110 
111