summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-07 10:17:58 +0200
committerMichael Stahl <mstahl@redhat.com>2012-09-10 23:43:38 +0200
commitb89ae706c2b959dd41e821abc2efe1d4ba79de81 (patch)
tree03224d32d8ad6ffe76d29cb23c498ed773bc30f6 /odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
parentef0e7694b884d3cd86295b733028101cc4713fa1 (diff)
Java cleanup, generic and simplify
The code here is passing stuff around in lists of Object, but even so, it was doing so in a very convoluted way. Change-Id: I608a066138bde2b659a52f6e6148ac754f75ac74
Diffstat (limited to 'odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java')
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java51
1 files changed, 26 insertions, 25 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
index 4250cfe08ea2..54b58309538e 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
@@ -77,7 +77,7 @@ class OnewayExecutor extends Thread
*/
private IOnewayLink m_rLink ;
private int m_nRequest ;
- private Vector<?> m_lParams ;
+ private Vector<Object> m_lParams ;
// _______________________________
@@ -103,7 +103,7 @@ class OnewayExecutor extends Thread
*/
public OnewayExecutor( IOnewayLink rLink ,
int nRequest ,
- Vector<?> lParams )
+ Vector<Object> lParams )
{
m_rLink = rLink ;
m_nRequest = nRequest;
@@ -138,48 +138,49 @@ class OnewayExecutor extends Thread
/**
* static helper!
- * To make convertion of the generic parameter list to the original
- * one easier - you can use this helper methods. They know how suchlist
+ * To make conversion of the generic parameter list to the original
+ * one easier - you can use this helper methods. They know how such list
* must be coded. It's not a must to use it - but you can ...
*/
// _______________________________
- public static void codeDispatch(
- boolean bEncode, Vector[] lParams,
+ public static Vector<Object> encodeDispatch(
com.sun.star.util.URL[] aURL,
com.sun.star.beans.PropertyValue[][] lArgs)
{
- if (bEncode)
- {
- int nLength = lArgs.length+1;
- int nPos = 0;
- lParams[0] = new Vector<Object>(nLength);
+ int nLength = lArgs.length+1;
+ int nPos = 0;
+ Vector<Object> lParams = new Vector<Object>(nLength);
- lParams[0].add( (Object)aURL[0] );
- --nLength;
+ lParams.add( aURL[0] );
+ --nLength;
- while (nLength>0)
- {
- lParams[0].add( (Object)lArgs[0][nPos] );
- --nLength;
- ++nPos ;
- }
- }
- else
+ while (nLength>0)
{
- int nLength = lParams[0].size()-1;
+ lParams.add( lArgs[0][nPos] );
+ --nLength;
+ ++nPos ;
+ }
+ return lParams;
+ }
+
+ public static void decodeDispatch(
+ Vector<Object> lParams,
+ com.sun.star.util.URL[] aURL,
+ com.sun.star.beans.PropertyValue[][] lArgs)
+ {
+ int nLength = lParams.size()-1;
int nPos = 0;
lArgs[0] = new com.sun.star.beans.PropertyValue[nLength];
- aURL[0] = (com.sun.star.util.URL)(lParams[0].elementAt(0));
+ aURL[0] = (com.sun.star.util.URL) lParams.elementAt(0);
while (nPos<nLength)
{
lArgs[0][nPos] = (com.sun.star.beans.PropertyValue)
- (lParams[0].elementAt(nPos+1));
+ (lParams.elementAt(nPos+1));
++nPos;
}
- }
}
}