Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "java/sql/DriverPropertyInfo.hxx"
21 : #include "java/lang/Boolean.hxx"
22 : #include "java/tools.hxx"
23 : #include "java/lang/String.hxx"
24 :
25 : using namespace connectivity;
26 : using namespace ::com::sun::star::uno;
27 : using namespace ::com::sun::star::beans;
28 : using namespace ::com::sun::star::sdbc;
29 : using namespace ::com::sun::star::container;
30 : using namespace ::com::sun::star::lang;
31 :
32 :
33 :
34 : //************ Class: java.sql.Driver
35 :
36 :
37 : jclass java_sql_DriverPropertyInfo::theClass = 0;
38 :
39 0 : java_sql_DriverPropertyInfo::~java_sql_DriverPropertyInfo()
40 0 : {}
41 :
42 0 : jclass java_sql_DriverPropertyInfo::getMyClass() const
43 : {
44 : // the class must be fetched only once, therefore static
45 0 : if( !theClass )
46 0 : theClass = findMyClass("java/sql/DriverPropertyInfo");
47 0 : return theClass;
48 : }
49 :
50 :
51 0 : java_sql_DriverPropertyInfo::operator css::sdbc::DriverPropertyInfo()
52 : {
53 0 : css::sdbc::DriverPropertyInfo aInfo;
54 0 : aInfo.Name = name();
55 0 : aInfo.Description = description();
56 0 : aInfo.IsRequired = required();
57 0 : aInfo.Value = value();
58 0 : aInfo.Choices = choices();
59 :
60 0 : return aInfo;
61 : }
62 :
63 0 : OUString java_sql_DriverPropertyInfo::name()
64 : {
65 0 : OUString aStr;
66 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
67 :
68 : {
69 0 : jfieldID id = t.pEnv->GetFieldID(getMyClass(),"name","Ljava/lang/String;");
70 0 : if(id)
71 0 : aStr = JavaString2String(t.pEnv, static_cast<jstring>(t.pEnv->GetObjectField( object, id)));
72 : } //t.pEnv
73 0 : return aStr;
74 : }
75 :
76 0 : OUString java_sql_DriverPropertyInfo::description()
77 : {
78 0 : OUString aStr;
79 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
80 :
81 : {
82 0 : jfieldID id = t.pEnv->GetFieldID(getMyClass(),"description","Ljava/lang/String;");
83 0 : if(id)
84 0 : aStr = JavaString2String(t.pEnv, static_cast<jstring>(t.pEnv->GetObjectField( object, id)));
85 : } //t.pEnv
86 0 : return aStr;
87 : }
88 :
89 0 : OUString java_sql_DriverPropertyInfo::value()
90 : {
91 0 : OUString aStr;
92 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
93 :
94 : {
95 0 : jfieldID id = t.pEnv->GetFieldID(getMyClass(),"value","Ljava/lang/String;");
96 0 : if(id)
97 0 : aStr = JavaString2String(t.pEnv, static_cast<jstring>(t.pEnv->GetObjectField( object, id)));
98 : } //t.pEnv
99 0 : return aStr;
100 : }
101 :
102 0 : bool java_sql_DriverPropertyInfo::required()
103 : {
104 0 : jboolean out(0);
105 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
106 :
107 : {
108 0 : jfieldID id = t.pEnv->GetFieldID(getMyClass(),"required","Z");
109 0 : if(id)
110 0 : out = t.pEnv->GetBooleanField( object, id);
111 : } //t.pEnv
112 0 : return out;
113 : }
114 :
115 0 : Sequence< OUString> java_sql_DriverPropertyInfo::choices()
116 : {
117 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
118 :
119 : {
120 0 : jfieldID id = t.pEnv->GetFieldID(getMyClass(),"choices","[Ljava/lang/String;");
121 0 : if(id)
122 : {
123 0 : const java_lang_String * pEmpty = NULL;
124 0 : const OUString * pEmpty2 = NULL;
125 0 : return copyArrayAndDelete(t.pEnv, static_cast<jobjectArray>(t.pEnv->GetObjectField( object, id)), pEmpty2, pEmpty);
126 : }
127 : } //t.pEnv
128 0 : return Sequence< OUString>();
129 : }
130 :
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|