summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-04-23 09:18:08 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-04-23 10:31:15 +0000
commitbc8b419b0dc8bffb70accce443f4f46aa48cbd58 (patch)
treeb360433fe8dfaaa1e58bbdff87b2667cc671a0b5 /odk
parentada02981672ae74bbdf6c4e5606d78c9211b2317 (diff)
Java cleanup - use generics to reduce casting
More queryInterface related cleanup. Change-Id: I97d064c425389e687c6f0fbc3a962080f46dd511 Reviewed-on: https://gerrit.libreoffice.org/3568 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/DevelopersGuide/Forms/ButtonOperator.java2
-rw-r--r--odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java10
-rw-r--r--odk/examples/DevelopersGuide/Forms/FLTools.java6
-rw-r--r--odk/examples/DevelopersGuide/Forms/SalesFilter.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java12
5 files changed, 16 insertions, 16 deletions
diff --git a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java
index 113b7043e08c..a447381a2c69 100644
--- a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java
+++ b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java
@@ -148,7 +148,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
public void actionPerformed( ActionEvent aEvent ) throws com.sun.star.uno.RuntimeException
{
// get the model's name
- XPropertySet buttonModel = (XPropertySet)FLTools.getModel( aEvent.Source, XPropertySet.class );
+ XPropertySet buttonModel = FLTools.getModel( aEvent.Source, XPropertySet.class );
try
{
short formFeature = getAssociatedFormFeature( buttonModel );
diff --git a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
index 25308ea29cf1..09befbef9a58 100644
--- a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
+++ b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
@@ -69,7 +69,7 @@ class DocumentViewHelper
@param aInterfaceClass
the class of the interface which shall be returned
*/
- public Object get( Class aInterfaceClass )
+ public <T> T get( Class<T> aInterfaceClass )
{
return UnoRuntime.queryInterface( aInterfaceClass, m_controller );
}
@@ -88,7 +88,7 @@ class DocumentViewHelper
XDispatch xReturn = null;
// go get the current view
- XController xController = (XController)get( XController.class );
+ XController xController = get( XController.class );
// go get the dispatch provider of it's frame
XDispatchProvider xProvider = UnoRuntime.queryInterface(
XDispatchProvider.class, xController.getFrame() );
@@ -119,7 +119,7 @@ class DocumentViewHelper
*/
public XFormController getFormController( Object _form )
{
- XFormLayerAccess formLayer = (XFormLayerAccess)get( XFormLayerAccess.class );
+ XFormLayerAccess formLayer = get( XFormLayerAccess.class );
return formLayer.getFormController( UnoRuntime.queryInterface( XForm.class, _form ) );
}
@@ -133,7 +133,7 @@ class DocumentViewHelper
public XControl getFormControl( XControlModel xModel ) throws com.sun.star.uno.Exception
{
// the current view of the document
- XControlAccess xCtrlAcc = (XControlAccess)get( XControlAccess.class );
+ XControlAccess xCtrlAcc = get( XControlAccess.class );
// delegate the task of looking for the control
return xCtrlAcc.getControl( xModel );
}
@@ -146,7 +146,7 @@ class DocumentViewHelper
}
/* ------------------------------------------------------------------ */
- public Object getFormControl( Object aModel, Class aInterfaceClass ) throws com.sun.star.uno.Exception
+ public <T> T getFormControl( Object aModel, Class<T> aInterfaceClass ) throws com.sun.star.uno.Exception
{
XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, aModel );
return UnoRuntime.queryInterface( aInterfaceClass, getFormControl( xModel ) );
diff --git a/odk/examples/DevelopersGuide/Forms/FLTools.java b/odk/examples/DevelopersGuide/Forms/FLTools.java
index 143816625e44..36d4fb3e25b5 100644
--- a/odk/examples/DevelopersGuide/Forms/FLTools.java
+++ b/odk/examples/DevelopersGuide/Forms/FLTools.java
@@ -159,7 +159,7 @@ public class FLTools
/* ------------------------------------------------------------------ */
/** retrieves the parent of the given object
*/
- static Object getParent( Object aComponent, Class aInterfaceClass )
+ static <T> T getParent( Object aComponent, Class<T> aInterfaceClass )
{
XChild xAsChild = UnoRuntime.queryInterface( XChild.class, aComponent );
@@ -171,7 +171,7 @@ public class FLTools
*/
static XPropertySet getParent( Object aComponent )
{
- return (XPropertySet)getParent( aComponent, XPropertySet.class );
+ return getParent( aComponent, XPropertySet.class );
}
/* ------------------------------------------------------------------ */
@@ -188,7 +188,7 @@ public class FLTools
/* ------------------------------------------------------------------ */
/** get's the XControlModel for a control
*/
- static public Object getModel( Object aControl, Class aInterfaceClass )
+ static public <T> T getModel( Object aControl, Class<T> aInterfaceClass )
{
XControl xControl = UnoRuntime.queryInterface(
XControl.class, aControl );
diff --git a/odk/examples/DevelopersGuide/Forms/SalesFilter.java b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
index df7e96aa2d64..e4c516160d0f 100644
--- a/odk/examples/DevelopersGuide/Forms/SalesFilter.java
+++ b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
@@ -107,7 +107,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
// for the button, we can add to the control only, not to the model
// - clicking a button is something which happens on the _control_.
DocumentViewHelper aView = m_aDocument.getCurrentView();
- XButton xButton = (XButton)aView.getFormControl( m_xApplyFilter, XButton.class );
+ XButton xButton = aView.getFormControl( m_xApplyFilter, XButton.class );
xButton.addActionListener( this );
}
catch ( com.sun.star.uno.Exception e )
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java
index 4af8213ea286..f7cf1d3f07b5 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java
@@ -126,10 +126,10 @@ public class OfficeConnect
* @param sServiceSpecifier name of service which should be created
* @return the new created service object
*/
- public static synchronized Object createRemoteInstance(
- Class aType, String sServiceSpecifier)
+ public static synchronized <T> T createRemoteInstance(
+ Class<T> aType, String sServiceSpecifier)
{
- Object aResult = null;
+ T aResult = null;
try
{
aResult = UnoRuntime.queryInterface(aType,
@@ -157,10 +157,10 @@ public class OfficeConnect
* @param sServiceSpecifier Description of Parameter
* @return the new create service object
*/
- public static synchronized Object createRemoteInstanceWithArguments(
- Class aType, String sServiceSpecifier, Any[] lArguments)
+ public static synchronized <T> T createRemoteInstanceWithArguments(
+ Class<T> aType, String sServiceSpecifier, Any[] lArguments)
{
- Object aResult = null;
+ T aResult = null;
try
{
aResult = UnoRuntime.queryInterface(aType,