2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package com
.sun
.star
.lib
.uno
.environments
.remote
;
21 import com
.sun
.star
.uno
.IMethodDescription
;
22 import com
.sun
.star
.uno
.ITypeDescription
;
23 import com
.sun
.star
.uno
.XCurrentContext
;
26 * A remote request or reply message.
28 public class Message
{
30 ThreadId threadId
, boolean request
, String objectId
,
31 ITypeDescription type
, IMethodDescription method
, boolean synchronous
,
32 XCurrentContext currentContext
, boolean abnormalTermination
,
33 Object result
, Object
[] arguments
)
35 this.threadId
= threadId
;
36 this.request
= request
;
37 this.objectId
= objectId
;
40 this.synchronous
= synchronous
;
41 this.currentContext
= currentContext
;
42 this.abnormalTermination
= abnormalTermination
;
44 this.arguments
= arguments
;
48 * Returns the thread ID of the message.
50 * <p>Valid for all kinds of messages.</p>
52 * @return the (non-<code>null</code>) thread ID.
54 public final ThreadId
getThreadId() {
59 * Returns whether the message is a request or a reply.
61 * <p>Valid for all kinds of messages.</p>
63 * @return <code>true</code> for a request, <code>false</code> for a reply.
65 public final boolean isRequest() {
70 * Returns the object ID of a request message.
72 * <p>Valid only for request messages.</p>
74 * @return the (non-<code>null</code>) object ID for a request,
75 * <code>null</code> for a reply.
77 public final String
getObjectId() {
82 * Returns the type of a request message.
84 * <p>Valid only for request messages.</p>
86 * @return the (non-<code>null</code>) type for a request, <code>null</code>
89 public final ITypeDescription
getType() {
94 * Returns the method description of a request message.
96 * <p>Valid only for request messages. The returned
97 * <code>IMethodDescription</code> is consistent with the type of the
100 * @return the (non-<code>null</code>) method description for a request,
101 * <code>null</code> for a reply.
103 public final IMethodDescription
getMethod() {
108 * Returns whether the request message is synchronous.
110 * <p>Valid only for request messages.</p>
112 * @return <code>true</code> for a synchronous request, <code>false</code>
113 * for an asynchronous request or a reply.
115 public final boolean isSynchronous() {
120 * Returns the current context of a request message.
122 * <p>Valid only for request messages.</p>
124 * @return the current context (which may be <code>null</code>) for a
125 * request, <code>null</code> for a reply.
127 public XCurrentContext
getCurrentContext() {
128 return currentContext
;
132 * Returns whether the reply message represents abnormal termination.
134 * <p>Valid only for reply messages.</p>
136 * @return <code>true</code> for a reply that represents abnormal
137 * termination, <code>false</code> for a reply that represents normal
138 * termination or a request.
140 public final boolean isAbnormalTermination() {
141 return abnormalTermination
;
145 * Returns the result of a reply message.
147 * <p>Valid only for reply messages.</p>
149 * @return any (possibly <code>null</code>) return value for a reply that
150 * represents normal termination, the (non-<code>null</code>) exception for
151 * a reply that represents abnormal termination, <code>null</code> for a
154 public final Object
getResult() {
159 * Returns the arguments of a message.
161 * <p>Valid only for request messages and reply messages that represent
162 * normal termination. Any returned array must not be modified.</p>
164 * @return the in and in– {
165 * }out arguments for a request (possibly
166 * <code>null</code> for a paramterless function), the out and in– {
168 * arguments for a reply that represents normal termination (possibly
169 * <code>null</code> for a parameterless function), <code>null</code> for a
170 * reply that represents abnormal termination.
172 public final Object
[] getArguments() {
176 private final ThreadId threadId
;
177 private final boolean request
;
178 private final String objectId
;
179 private final ITypeDescription type
;
180 private final IMethodDescription method
;
181 private final boolean synchronous
;
182 private final XCurrentContext currentContext
;
183 private final boolean abnormalTermination
;
184 private final Object result
;
185 private final Object
[] arguments
;