Nameless Nested Classes passed in Function Parameter?

I am trying to get my head around the following code example:
javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run() { createAndShowGUI(); }});What is actually getting passed to the SwingUtilities.invokeLater() function?
Can anyone explain all of the parts and pieces of :
new Runnable() { public void run() { createAndShowGUI(); }} ?
Here is my best guess:
1) { public void run() { createAndShowGUI(); }} is an unnamed nested class that is instantiated using the Runnable() interface.
2) this class has one method called run() that executes createAndShowGUI();
Is my best guess even close to what is really going on?

richard.broersma wrote:
1) { public void run() { createAndShowGUI(); }} is an unnamed nested class that is instantiated using the Runnable() interface.Yes, that's essentially correct. It's called an anonymous inner class.
This is similar to doing
// a non-anonymous inner class
private class MyClass implements Runnable
  public void run()
    createAndShowGUI();
MyClass myclass = new MyClass();
javax.swing.SwingUtilities.invokeLater(myclass);
2) this class has one method called run() that executes createAndShowGUI();Yes. It must have a parameterless public void run method since it implements the Runnable interface.
Is my best guess even close to what is really going on?Yes, you're catching on.

Similar Messages

  • Missing Data in Table passed as Function Parameter

    I am running a JCO server & in my handleRequest(), I am trying to get the data from the tables paased as function parameters from the SAP system.
    Somehow I am not able to see any data in the tables, though the SAP system has put some data in the tables before sending.
    The no. of rows in the table is 0 always on the JCO side. I tried to dunp the content of the Function & Table with writeHTML() & it shows no data too.
    I am able to pass simple strings & integers, but the tables doesn't work. Can anyone tell me where might be the problem.

    Hi,
       I am bit confused, You are not getting the data in the Function module when you make a call from Java or the data returned by the function module is not reaching the Java side. If you are not getting the data which you pass from java in the function module then I have faced this problem before.
    In that case the problem was when you pass data as table parameters to the function module you have to check the size of table parameter I was using INITIAL to check if there is any data in the table parameter. If this is the same problem may be by checking the size of the table will solve your problem.
    Regards,
    Sesh

  • Missing Data in JCO.Table passed as Function Parameter

    I am running a JCO server & in my handleRequest(), I am trying to get the data from the tables paased as function parameters from the SAP system.
    Somehow I am not able to see any data in the tables, though the SAP system has put some data in the tables before sending.
    The no. of rows in the table is 0 always on the JCO side. I tried to dunp the content of the Function & Table with writeHTML() & it shows no data too.
    I am able to pass simple strings & integers, but the tables doesn't work. Can anyone tell me where might be the problem.

    Can you post the code you have used !

  • How to pass "EnterpriseManagementObject" Type as Function parameter?

    Hello, dear Colleagues.
    I'm trying to  pass "EnterpriseManagementObject" as Function parameter.
    Here is the piece of code:
    $SCSM = 'SERVER_NAME'
    function Add-Comment {
    param (
    [parameter(Mandatory=$true,Position=0)][Alias('Id')][String]$pSRId,
    [parameter(Mandatory=$true,Position=1)][Alias('Comment')][String]$pComment,
    [parameter(Mandatory=$true,Position=2)][Alias('EnteredBy')][String]$pEnteredBy,
    [parameter(Mandatory=$true,Position=3)][Alias('IsAnalyst')][Bool]$AnalystComment,
    [parameter(Mandatory=$true,Position=4)][Alias('IRObject')][EnterpriseManagementObject]$IRObject
    if ($IRObject) {
    $NewGUID = ([guid]::NewGuid()).ToString()
    if ($AnalystComment)
    $Projection = @{__CLASS = "System.WorkItem.Incident";
    __SEED = $IRObject;
    AnalystComments = @{__CLASS = "System.WorkItem.TroubleTicket.AnalystCommentLog";
    __OBJECT = @{"Id" = $NewGUID;
    Comment = $pComment;
    DisplayName = $NewGUID;
    EnteredBy = $pEnteredBy;
    EnteredDate = (Get-Date).ToUniversalTime();
    IsPrivate = $false
    New-SCSMObjectProjection -Type System.WorkItem.IncidentPortalProjection -Projection $Projection -ComputerName $SCSM -ErrorAction stop
    } else {
    Write-Host $pSRId "could not be found"
    $IncidentClass = Get-SCSMClass -name System.WorkItem.Incident$ -ComputerName $SCSM
    $Incident = Get-SCSMObject -Class $IncidentClass -Filter "name -eq $c" -ComputerName $SCSM
    Add-Comment -Id $c -Comment $text -EnteredBy $name -IsAnalyst $False -IRObject $Incident -ErrorAction stop
    With GetType() I watched $Incident is "EnterpriseManagementObject":
    IsPublic IsSerial Name BaseType
    True True EnterpriseManagementObject Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectBaseWithProperties
    But PS script returns error TypeNotFound:
    Add-Comment : Unable to find type [EnterpriseManagementObject]. Make sure that the assembly that contains this type is loaded.
    At C:\script.ps1:146 char:13
    + Add-Comment -Id $c -Comment $text -EnteredBy $name -IsAnalyst $True ...
    + ~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (EnterpriseManagementObject:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound
    Is there a way to  pass "EnterpriseManagementObject" as Function parameter?
    Thanks.

    First of all the error indicates that you haven't loaded the assembly which contains the class you're trying to load.
    Try loading the assembly by running:
    [Reflection.Assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.Core") | Out-Null
    Secondly if you want to use type based parameters restrictions you should use full type name, which can be found with the command:
    $SomeObject.GetType().FullName
    You should end up with: Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject

  • Can I pass a table function parameter like this?

    This works. Notice I am passing the required table function parameter using the declared variable.
    DECLARE @Date DATE = '2014-02-21'
    SELECT
    h.*, i.SomeColumn
    FROM SomeTable h
    LEFT OUTER JOIN SomeTableFunction(@Date) I ON i.ID = h.ID
    WHERE h.SomeDate = @Date
    But I guess you can't do this?... because I'm getting an error saying h.SomeDate cannot be bound. Notice in this one, I am attempting to pass in the table function parameter from the SomeTable it is joined to by ID.
    DECLARE @Date DATE = '2014-02-21'
    SELECT
    h.*, i.SomeColumn
    FROM SomeTable h
    LEFT OUTER JOIN SomeTableFunction(h.SomeDate) I ON i.ID = h.ID
    WHERE h.SomeDate = @Date

    Hi
    NO you cant pass a table function parameter like this?
    As When you declare @date assign value to it and pass as a parameter it will return table which you can use for join as you did it in first code 
    But when you pass date from some other table for generating table from your funtion it doesnt have date as it is not available there
    Ref :
    http://www.codeproject.com/Articles/167399/Using-Table-Valued-Functions-in-SQL-Server
    http://technet.microsoft.com/en-us/library/aa214485(v=sql.80).aspx
    http://msdn.microsoft.com/en-us/library/ms186755.aspx
    https://www.simple-talk.com/sql/t-sql-programming/sql-server-functions-the-basics/
    http://www.sqlteam.com/article/intro-to-user-defined-functions-updated
    Mark
    as answer if you find it useful
    Shridhar J Joshi Thanks a lot

  • How to pass class object  as in parameter in call to pl/sql procedure ?

    hi,
    i have to call pl/sql proecedure through java. In pl/sql procedure as "In" parameter i have created "user defined record type" and i am passing class object as "In" parameter in call to pl/sql procedure. but it is giving error.
    so, anyone can please tell me how i can pass class object as "In" parameter in call to pl/sql procedure ?
    its urgent ...
    pls help me...

    793059 wrote:
    I want to pass a cursor to a procedure as IN parameter.You can use the PL/SQL type called sys_refcursor - and open a ref cursor and pass that to the procedure as input parameter.
    Note that the SQL projection of the cursor is unknown at compilation time - and thus cannot be checked. As this checking only happens at run-time, you may get errors attempting to fetch columns from the ref cursor that does not exist in its projection.
    You also need to ask yourself whether this approach is a logical and robust one - it usually is not. The typical cursor processing template in PL/SQL looks as follows:
    begin
      open cursorVariable;
      loop
        fetch cursorVariable bulk collect into bufferVariable limit MAX_ROWS_FETCH;
        for i in 1..bufferVariable.Count
        loop
          MyProcedure( buffer(i) );   --// <-- Pass a row structure to your procedure and not a cursor
        end loop;
        ..etc..
        exit when cursorVariable%not_found;
      end loop;
      close cursorVariable;
    end;

  • Oci oracle8i - how do oci to pass a varray parameter to a function

    How do oci to pass a varray parameter to a function?

    don't declare a variable inside a function body unless you want it to be local to that function/function call.  ie, use:
    var cont:int;
    function whatever(){
    cont=whatever;

  • Pass rowtype as function parameter, as a Object like type. How?

    Hi.
    I have the following question.
    I have 3 tables:
    TAB1
    TAB2
    TAB3
    I declare 3 rowtypes variables, one for each table:
    v_tab1 TAB1%ROWTYPE;
    v_tab2 TAB2%ROWTYPE;
    v_tab3 TAB3%ROWTYPE;
    I want to pass a rowtype as a function parameter, but i want the function to allow any rowtype to be passed as parameter, and then inside the function convert that "object" to the correct rowtype.
    Is that possible?
    In another language like C# for example, i would pass the rowtype as a object type, and then cast it to the correct data type.
    I hope you can help me.
    Cheers.

    To do this they would have to be object types, and have a common supertype.Alternatively unrelated object types could be abstracted away with ANYDATA.
    There is no such functionality exposed / documented for records - although the signatures of several built-in packages suggest that a mechanism for passing ADTs as formal parameters does actually exist.

  • Pass TestStand error type directly into function parameter

    Hi,
    I am using TestStand 4 and Labwindows CVI 8.5.
    I wonder if it is possible to pass Standard Step error type into CVI function parameters.
    I think it would be more simple to pass one parameter instead of passing Error code, Error occurred state and Error message into function prototype.
    I tried to use tsErrorDataType struct defined into tsutil.h into my function prototype.
    In TestStand, I pass Step error type into function parameter but it does not work.
    TestStand displays an error meaning parameters does not match function prototype.
    Thank you for your help.

    Hi Tartempion,
    In order to pass the TestStand Error Container as one parameter to a function in a CVI DLL, you must use a struct that is typedef'ed and create an .fp file that is included as a type library for the DLL. When you create a .fp file to add to a DLL, the DLL will not build unless all structs/enums are typedef'ed. Thus, I wouldn't advise using the tsutil.h because you would have to go through and typedef every single struct and enum in the header file.
    Instead, you can simply create a typedef'ed struct in your projects header file and create an .fp file with the struct specified as a data type. Then in TestStand, when you call the function you would need to ensure that the parameter is of Category "C Struct", and type "Error". The attached zip file contains a CVI 8.5 project that demonstrates this along with a TestStand 4.0 sequence file that demonstrates how to pass the parameter to the function by reference. In case you run into trouble creating the .fp file please refer to the following KnowledgeBase. The instructions are for enums but easily correspond to structs as well:
    TestStand and LabWindows/CVI Enumeration Data Types
    Hope this helps!
    Manooch H.
    National Instruments
    Attachments:
    PassTSError.zip ‏19 KB

  • Is possible pass class reference into function by reference ?

    Hello, here is one example.
    class MyClass
    public int i;
    public static void Change(MyClass param1, MyClass param2)
    MyClass temp;
    temp = param1;
    param1 = param2;
    param2 = temp;
    public static void main(String[] args)
    MyClass param1 = new Main();
    param1.i = 100;
    MyClass param2 = new Main();
    param2.i = 200;
    Change(param1,param2);
    System.out.println(param1.i);
         System.out.println(param2.i);
    Is clear the result will be :
    100
    200
    Well, is possible in java pass into function object reference by reference? (for example in C# exist keyword ref, which solve this problem.) Other question is if this is something what is really needed in daily programming life, but I'm curious.
    Thanks for response

    iaragorn wrote:
    Well, is possible in java pass into function object reference by reference? No. Java only passes by value.
    Other question is if this is something what is really needed in daily programming lifeNope. Java has done just fine without pass by reference for about 12 or 14 years now.

  • Instantiating a nested class from JNI

    Im able to instantiate my public member class "Inner" as long as the constructor does not take any arguments. If it requires arguments in the constructor, I get a crash report. I need to be able to instantiate the object with supplied initial arguments. Is this a bug in the JVM? Any suggestions?
    /dan
    Crash report follows after code:
    class HelloWorld {
       public class Inner {
          private int myValue = 50;
          public Inner() {}
          public Inner(int myValue) {
             this.myValue = myValue;
          public Inner(int myValue, int there) {
             this.myValue = myValue;
    }C++ library:
       jclass inr_clz = env->FindClass("LHelloWorld$Inner;");
       if (inr_clz == NULL) {
          return -25;               // failed to find the class
    //   mid = env->GetMethodID(inr_clz, "<init>", "(LHelloWorld;)V");              // works
       mid = env->GetMethodID(inr_clz, "<init>", "(LHelloWorld;II)V");            // also works
       if (mid == NULL) {
          return -30;                    // failed to get method
       jint value = 400;
    //   inner = env->NewObject(inr_clz, mid);                           // works
       inner = env->NewObject(inr_clz, mid, value, value);             // crash here
       if (inner == NULL) {
          return -40;                     // out of memory error
       ...Crash message:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # Internal Error (53484152454432554E54494D450E43505001A3), pid=2008, tid=2628
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode)
    # An error report file with more information is saved as hs_err_pid2008.log
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    #

    Im able to instantiate my public member class "Inner"
    as long as the constructor does not take any
    arguments. If it requires arguments in the
    constructor, I get a crash report. I need to be able
    to instantiate the object with supplied initial
    arguments. Is this a bug in the JVM? Any
    suggestions?It's your code.
    Here's a working example:
    ==================
    public class NativeInnerTest {
         public static void main(String[] args) {
              new Outer().doNative();
    public class Outer {
         static {
              System.loadLibrary("outer");
         public class Inner {
              private int val;
              Inner (int val) {
                   this.val = val;
              public void foo() {
                   System.out.println("Value is: " + val);
         public native void doNative();
    }=====Native Code======================
    #include "Outer.h"
    JNIEXPORT void JNICALL Java_Outer_doNative (JNIEnv *env, jobject obj) {
         jclass clz = env->FindClass("Outer$Inner");
         if (clz == NULL) {
              printf("Failed to find class Outer$Inner");
              return;
         jmethodID mid = env->GetMethodID(clz,"<init>", "(LOuter;I)V");
         if (mid == NULL) {
              printf ("Failed to find Inner constructor\n");
              return;
         jint val = 42;
         jobject inner = env->NewObject(clz,mid,obj,val);
         if (inner == NULL) {
              printf ("Failed to construct Inner object\n");
              return;
         jmethodID fooID = env->GetMethodID(clz, "foo", "()V");
         if (fooID ==  NULL) {
              printf ("Failed to find method id for foo()\n");
              return;
         env->CallVoidMethod(inner, fooID);
    }================================
    The problem in your code is twofold. First, your type signature in the call to GetMethodID is incorrect. An inner class constructor taking a single integer argument should have a type signature like this:
    (LHelloWorld;I)V
    You can get the proper type signatures using the 'javap' tool. For my example, the output of javap looks like this:
    [jim@daisy tmp]$ /usr/java/jdk1.6.0/bin/javap -s -private Outer.Inner
    Compiled from "Outer.java"
    public class Outer$Inner extends java.lang.Object{
    private int val;
      Signature: I
    final Outer this$0;
      Signature: LOuter;
    Outer$Inner(Outer, int);
      Signature: (LOuter;I)V
    public void foo();
      Signature: ()V
    }Second, your call to NewObject does not have the proper parameter types. Here's your code:
    inner = env->NewObject(inr_clz, mid, value, value);The corresponding correct line from my example is:
    jobject inner = env->NewObject(clz,mid,obj,val);The constructor expects a 'HelloWorld' object and an integer as denoted in the correct
    type signature.
    You are passing in the integer 'val' twice when you should be doing something like this:
    inner = env->NewObject(inr_clz, mid, obj, value);where 'obj' is the jobject passed to you by the VM along with the JNIEnv pointer. This jobject represents the instance of the enclosing class which every non static nested class must have.
    Jim S.

  • How to pass a date parameter from report builder query designer to oracle database

    i'm using report builder 3.0 connected to oracle database. i'm trying to pass a date parameter in the query with no success, i don't
    know the exact syntax. I've tried :
    SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date('01/01/2014','mm/dd/yyyy')
    it worked perfectly.
    However if i try to put a date parameter "From" instead of 01/01/2014 it will not work, a Define Query Parameter popup window appear and error occurred after i fill
    the values (usually i shouldnt get this popup i should enter the value when i run the report)
    SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date(:From,'mm/dd/yyyy')
    appreciate your assistance

    Hi Gorgo,
    According to your description, you have problem when in passing a parameter for running a Oracle Query. Right?
    Based on my knowledge, it use "&" as synax for parameter in Oracle, like we use "@" in SQL Server. In this scenario, maybe you can try '01/01/2014' when inputing in "From". We are not sure if there's any limitation for To_Date()
    function. For your self-testing, you can try the query in sqlplus/sql delveloper. Since your issue is related to Oracle query, we suggest you post this thread onto Oracle forum.
    Best Regards,
    Simon Hou

  • Determine class type of Generic Parameter (not via getGenericSuperclass()!)

    I need to know the class type of a generic Parameter. Please imagine this class:
    class MyGenericClass<T>
    }In cases where other classes derived from MyClass and defined the generic parameter (like MyDerivedClass extends MyGenericClass<String>),
    this snippets works just fine:
    (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];But now I have no inheritance but the definition of the type parameter via instantiation:
    MyGenericClass<String> entity = new MyGenericClass<String>();The method "getGenericSuperclass()" does not suit my needs because it does not target the actual class. Nor can "getTypeParameters() " help me...
    After countless trying to retrieved the type information, I still have no clue how to determine for that case that (in my example) the type parameter
    is a 'String'.
    Does anyone know the solution?

    Serethos_0 wrote:
    Sure I could pass the class type itself as parameter to be stored in 'exportClassType'. But I only tried to adapt the idea used e.g. in Generic DAOs
    as descibed here: [http://community.jboss.org/wiki/GenericDataAccessObjects]. The big difference is, that in the Generic DAO example the typed
    information is available within the class definition ..
    Besides that I am open for any other suggestion!I would recommend passing around the Class object as you say.
    Some might suggest that you make MyGenericClass abstract, forcing any instantiation to be like this:
    MyGenericClass<String> entity = new MyGenericClass<String>() {};That would indeed cause the String type parameter to be available at runtime, since you're creating an anonymous inner class. But it leads to a convoluted and extremely statically expensive instantiation pattern. Using the class object is a better solution IMO.

  • Pass multi value parameter to sub report in Drill through report, ssrs

    I have two reports 1 is subreport and other is main report. Date Field are placed in both reports. i have groups in main report,
    one group is task. In the task fields one persons is working in 3 project, two project are same company and 1 is for other and it give me count for each project. I
    want when i click on link it send multivalue parameter to subreport and it just show matching records.
    Asif Mehmood

    As I understand what you need is to use LookupSet function. 
    Suppose if your dataset is like this (for simplicity I'm showing only required fields)
    PersonID Project Company
    ID1 P1 C1
    ID1 P2 C1
    ID1 P3 C2
    ID1 P4 C2
    ID1 P5 C3
    If you want to get the full project list for the person just send the PersonID alone and filter using it in the subreport. You can keep the project/company parameters optional in that case and put a default value. This would be the easiest thing.
    Now if you want pass the project parameter also you need to pass it like this
    =Join(LookupSet(Fields!Person.Value,Fields!Person.Value,Fields!Project.Value,"DatasetName"),",")
     This would act like a self lookup and return you full list of projects for the person and then you can use this to set the parameter value in the subreport.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • OpenDocument.aspx - pass multi value parameter when report type is actx

    We are running Crystal Reports XI R2 against a business objects infoview server.
    We have been successfully using the OpenDocuments method for opening crystal reports but have run into a snag.  When using a multi-value parameter, we can only get it to work when the viewer is set to HTML.  Setting to ActiveX prompts us to enter in the parameter values manually.
    This address works (using sViewer=HTML):
    http://vsx2af0x/businessobjects/enterprise115/infoview/scripts/opendocument.aspx?sType=rpt&sViewer=html&lsMpSiteIDs=[1235880],[1235891],[1235902],[1235913]&sPath=[Development][CGIS][Intranet Mapping][COS_Base]&sDocName=DetailedSite&sRefresh=Y
    This address does not work (using sVIewer=actx):
    http://vsx2af0x/businessobjects/enterprise115/infoview/scripts/opendocument.aspx?sType=rpt&sViewer=actx&lsMpSiteIDs=[1235880],[1235891],[1235902],[1235913]&sPath=[Development][CGIS][Intranet Mapping][COS_Base]&sDocName=DetailedSite&sRefresh=Y
    Any thoughts on the problem?

    As I understand what you need is to use LookupSet function. 
    Suppose if your dataset is like this (for simplicity I'm showing only required fields)
    PersonID Project Company
    ID1 P1 C1
    ID1 P2 C1
    ID1 P3 C2
    ID1 P4 C2
    ID1 P5 C3
    If you want to get the full project list for the person just send the PersonID alone and filter using it in the subreport. You can keep the project/company parameters optional in that case and put a default value. This would be the easiest thing.
    Now if you want pass the project parameter also you need to pass it like this
    =Join(LookupSet(Fields!Person.Value,Fields!Person.Value,Fields!Project.Value,"DatasetName"),",")
     This would act like a self lookup and return you full list of projects for the person and then you can use this to set the parameter value in the subreport.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

Maybe you are looking for

  • Purchase order to Asset non imposed the Internal Order.

    I'm entering a purchase order of an asset tied to an internal order of investment. The order has a budget X. If I enter a purchase order with value greater than the amount budgeted in the internal order, the system allows me to create the request and

  • Is it possible to add a column to the Item matrix in the ItemLookup form (C

    Hi, Is it possible to add a column to the Item matrix in the ItemLookup form (CFL or Find Lookup). I need to display a value in the newly added column if the itemgroup in that row matches a certain value , how can I achieve this. Thanks

  • Osx lion on macbook Pro

    I want to move my home folder to an external drive, I have read some posts, went into the user account, i am there as admin, for the life of me I cant find the advanced table to direct the home folder to the external folder, where I have a copy of my

  • PM-SMA and PM-PRO

    Dear friend, Please throw some light on this: I have been asked about the module PM which we have in the project, and they ask about PM-SMA (it seems is relationated with services??), and the other submodule PM-PRO about projects... do you have any i

  • Why can't I email my photos?

    My iPhoto doesn't recognize my identification ... I do have terrible problems with passwords ... they don't sync and I have to put new ones in over and over!  I end up taking my MacBook Pro (new) back to Best Buy where it takes 10 days for them to fi