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 AttributeTypeInfo extends TypeInfo
28 {
29 	protected int m_index;
30     private final Type m_unoType; // @since UDK 3.2
31 
32     /**
33        Create an attribute type info with a UNO type that cannot unambiguously
34        be represented as a Java 1.2 type.
35 
36        @param name the name of this attribute; must not be <code>null</code>
37 
38        @param index the index among the direct members
39 
40        @param flags any flags (<code>READONLY</code>, <code>BOUND</code>,
41        <code>UNSIGNED</code>, <code>ANY</code>, <code>INTERFACE</code>)
42 
43        @param unoType the exact UNO type; or <code>null</code> if the UNO type
44        is already unambiguously represented by the Java&nbsp;1.2 type
45 
46        @since UDK 3.2
47      */
AttributeTypeInfo(String name, int index, int flags, Type unoType)48     public AttributeTypeInfo(String name, int index, int flags, Type unoType) {
49         super(name, flags);
50         m_index = index;
51         m_unoType = unoType;
52     }
53 
AttributeTypeInfo(String name, int index, int flags)54 	public AttributeTypeInfo(String name, int index, int flags)
55 	{
56         this(name, index, flags, null);
57 	}
58 
getIndex()59 	public int getIndex()
60     {
61 		return m_index;
62 	}
63 
isReadOnly()64 	public boolean isReadOnly()
65 	{
66 		return (m_flags & TypeInfo.READONLY) != 0;
67 	}
68 
69     /**
70        Returns the status of the 'bound' flag.
71 
72        @since UDK 3.2
73      */
isBound()74     public final boolean isBound() {
75         return (m_flags & TypeInfo.BOUND) != 0;
76     }
77 
78     /**
79        Get the exact UNO type of this attribute type info, in case it cannot
80        unambiguously be represented as a Java&nbsp;1.2 type.
81 
82        @return the exact UNO type of this attribute type info, or
83        <code>null</code> if the UNO type is already unambiguously represented by
84        the Java&nbsp;1.2 type
85 
86        @since UDK 3.2
87      */
getUnoType()88     public final Type getUnoType() {
89         return m_unoType;
90     }
91 }
92