Passing Java statements in the parameter list

I am relatively new to Java and have a need to create a method which has a Java statement passed to it in the parameter list. The purpose is to optionally run this statement within the method. For example:
I have a method called rotateAndTranslate that sets up an Affine Transform by saving the existing transform context, creating a new transform, and then invoking that transform. After the new transform is invoked, I would like to have the ability to run different Java graphics commands (or not) before continuing with the remaining portion of the existing method (in this case, restoring the previous transform.
I am not able to find any clear information on how to pass in Java statements and then invoke them.
Can someone help with this? Please keep it simple as I am still trying to get my head around Java and OOP.
Carl

you're talking about closures, more or less, which java doesn't currently have
you can get close to it by using anonymous inner classes. define an interface, say Transformer, and pass instances of that as arguments:
public interface Transformer {
  void transform();
Transformer transformer = new Transformer() {
   public void transform() {
        // do the work here
MyTransformerClass.doTransform(transformer);
...obviously, the MyTransformerClass.doTransform() must take a Transformer as a parameter

Similar Messages

  • What is the parameter list and why does it keep on coming up?

    What is the parameter list and why does it keep on coming up when I try to finalize the video or share it?

    Hi
    I try to finalize the video or share it?
    How do You do that and to what do You Share it ?
    Yours Bengt W

  • How to get the parameter from Java Script into the Parameter crystal Report

    Hi All,
    Crystal Report is integrated with Oracle 10g. I created the base SQL query for col1, col2, col3 and col4. Java Script pass parameter value (185) to Col1.
    My question is how to create crystal report to make Col1 as parameter and how to get the parameter value 185(Col1) from Java Script. Is there any additional code I need to include in the crystal report?
    FYI.
    Java script sends the right parameter value.There is no issue in java script.
    This is an automatic scheduled process when batch runs, Java script should pass the parameter value and the crystal report should get the value and produce the output report.

    Not sure if this is an application question or if you are trying to hook into Crystal Reports parameter UI? If the later then no option other than report design. If an application then I can move this to the Java Forums.
    If you are asking how to alter the parameters I suggest you remove the Java reference and post a new question so it's not confusing the issue.
    Please clarify?

  • Can't we pass java.sql.Connection as parameter toDatum() method

    I am in mid of java 1.3 to 1.4 migration, now I am getting the below error.can't we pass java.sql.Connection as a param to toDatum(), but I did the same before for another module and it worked fine, now I am getting the error.
    any changes need to be done?
    [b]toDatum(oracle.jdbc.driver.OracleConnection,java.lang.String) in oracle.jpub.runtime.MutableArray cannot be applied to (java.sql.Connection,java.lang.String)
    return array.toDatum(c, SQL_NAME);
    ^
    1 error
    I changed to use
    import oracle.sql.ORAData;
    import oracle.sql.ORADataFactory;
    instead of
    import oracle.sql.CustomDatum;
    import oracle.sql.CustomDatumFactory;

    In general, it's bad practice to be that "open" with regards to parameters to methods, especially when using remote invocations. However, if you really, really, really, really need to - and I doubt you do - you can use Serializable for the type of parameter. But that's still inelegant and, well, raises all sorts of issues, starting with your design...

  • How to Display values in order when Multiple values are selected in the Parameter List

    <p>Hi</p><p>I have a report which runs on the parameter(SalesPersonName) selected.<br />Report has a group section where for each SalesPersonName we have different actions(Lead,Prospect,Active and so on) he had performed which is the basis for the group.</p><p>Now if i need multiple Value selection in the parameter,which i am able to acheive but the order in which it gets printed is not the right one.</p><p>I want intially all the actions performed by one sales person printed and then the second one should start.</p><p>Can any one help me in this aspect.</p><p>Thanks in advance</p>

    <p>If I understand your report structure correctly - you have one Grouping on Actions.  So could you not add another grouping on SalesPersonName above the Actions grouping that you currently have?</p><p>So the new structure would be:</p><p>G1 - SalesPersonName</p><p>G2 - Actions (current grouping you have)</p><p> </p><p>Whether or not you suppress or don&#39;t suppress the new grouping is your choice, but it will then force the ordering that you are asking about (assuming I understood) </p>

  • Multiple Label fields within the Parameter List of Available Values

    Hi,
    I have a business requirement where this is a period number which will be a value filed within a parameter. The labels of the parameter need to be the start date of the period and the end date of the period. What is the best way implement this in SSRS please?
    Since SSRS seems to be limited to one label field. My best quess at a solution is to concatinate the start and end period into a single field then expose this as the label.
    Is this the best approach to take?
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    You need to modify the dataset to concatenate start and end periods to get new field which can be used as your label field.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Import type for updating the parameter list to integrator-WEBADI

    Hi,
    Can anyone tell what are the import_type = 1,2,3,4,5 for updating the param list in the integrator for WEBADI.
    I know only that impot_type=3 is for procedure. what about 1,2 and 4.

    hi
    I knew that about import_type is as follows:
    1 Asynchronous concurrent request
    2 Synchronous concurrent request
    3 PL/SQL API
    4 not knew
    regards,
    leno

  • How to specify delimiter when parsing the parameter list in URL

    Here is a sample URL used to call the servlet:
    http://myhost.com/servlet?param1=test1&param2=test2&param3=test3In the doGet method of my servlet, I understand I can use the getParameter method to retrieve the various parameter values:
    String p_param1 = request.getParameter("param1");
    String p_param2 = request.getParameter("param2");
    String p_param3 = request.getParameter("param3");However, what if the URL was of the form:
    http://myhost.com/servlet?param1=test1+param2=test2+param3=test3where the URL parameter delimiter was a plus sign rather than an ampersand (&).
    By default, the servlet is only recognizing the ampersand (&) as a parameter delimiter.
    When I use a plus sign as the delimiter, getParameter retrieves everything after the question mark (?) as the first parameter
    i.e. param1 = test1 param2=test2 param3=test3
    param2 = null
    param3 = null
    How can I get getParameter to recognize a plus sign (+) as a valid delimiter?

    Servlets follow the HTTP specification. So, there is not much you can do on that level. What you could do (though I do not recommend it) is to set-up a filter that will automatically swap the plus with an ampersand before the actual servlet processes it. My strong advice, however, is to give up on using a nonstandard delimiter.
    [http://java.sun.com/products/servlet/Filters.html]
    - Saish

  • Runtime.exec() - Strips the parameter list on encountering  a newline(\n)

    I am executing a batch file from Runtime.exec() and i am passing a list of parameters to the batch file in the form of name=value pairs.One of the parameters value is a multiline text containing "\n" characters.i.e input from a textarea.
    When my program executes the batch file it prints all the parameters till it encounters the "\n" character and strips all the remianing parameters.And it does not show any error .
    Is this a bug of Runtime.exec method ?
    If not, how to resolve this problem?

    Bug in Runtime.exec? Nope, it's probably you and your code.
    Read this - everyone who uses Runtime.exec should:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Lots of deny statements in the redirect list

    The following WAAS Configuration Guide has you configure the long redirect list below for "Network Modules."  Does Cisco recommend we us the same redirect list for WAAS appliances as well?
    http://www.cisco.com/en/US/partner/docs/app_ntwk_services/waas/waas/v421/quick/guide/waasqcg.html#wp1432144
    ip wccp version 2
    ip wccp 61 redirect-list waas-wccp-redirect-list
    ip wccp 62 redirect-list waas-wccp-redirect-list
    ip access-list extended waas-wccp-redirect-list
    remark WAAS WCCP Pilot Redirect list
    deny tcp any any eq telnet
    deny tcp any any eq 22
    deny tcp any any eq 161
    deny tcp any any eq 162
    deny tcp any any eq 123
    deny tcp any any eq bgp
    deny tcp any any eq tacacs
    deny tcp any any eq 2000
    deny tcp any any eq 5060
    deny tcp any any eq 1718
    deny tcp any any eq 1719
    deny tcp any any eq 1720
    deny tcp any any eq 554
    deny tcp any any eq 1755
    deny tcp any eq telnet any
    deny tcp any eq 22 any
    deny tcp any eq 161 any
    deny tcp any eq 162 any
    deny tcp any eq 123 any
    deny tcp any eq bgp any
    deny tcp any eq tacacs any
    deny tcp any eq 2000 any
    deny tcp any eq 5060 any
    deny tcp any eq 1718 any
    deny tcp any eq 1719 any
    deny tcp any eq 1720 any
    deny tcp any eq 554 any
    deny tcp any eq 1755 any
    permit tcp any any
    end

    A short addendum to this post as it causes some confusion for customers:
    You don't have to configure a redirection ACL.
    Some reasons to exclude traffic from WCCP redirection are:
    you know some networks are not behind a WAE, so you can exclude them
    you know some server is doing bad things and want to exclude it from acceleration, for example DC -> DC traffic is signed, so WAAS cannot accelerate it.
    you want to reduce the latency on some very sensitive traffic that cannot get WAAS accelerated
    you want to reduce the amount of redirected traffic on a software platform to reduce the general CPU/traffic load
    Take into account that the WAAS will only ask to redirect TCP IPv4 traffic, so there is no need to exclude UDP for example.
    Please note that on hardware platforms (Catalyst 3750, Catalyst 4500, Catalyst 6500, ASR 1000 or Nexus 7000) the redirection is often accelerated in hardware, so  'free', and the limitation to watch is the amount of TCAM space. Having a complex redirection ACL will eat up that TCAM space very fast so is actually worse.
    Of course if you are redirecting too much traffic and this is causing overload on the attached WAAS devices you should consider having a redirection ACL.
    Also always check the WCCP platform support white paper for platform specific limitations.
    So in short: it depends , many customers take the easy route and don't have one, removing one more component to maintain and check.
    Peter

  • Passing Select-Option to OO method via parameter list

    Is it possible to pass a reference to a select-option through the parameter list of a method such that the parameter can be used in a "where clause" using the conventional "IN" operator?  If so, how should the parameter be typed? 
    Thanks in advance,
    Philip Smith

    Sure, here's how.
    report zrich_0002 no standard page heading.
    tables: mara.
    *       CLASS lcl_app DEFINITION
    class lcl_app definition.
      public section.
        types: t_matnr type range of mara-matnr.
        data: imara type table of mara.
        methods: constructor importing im_matnr type t_matnr.
    endclass.
    *       CLASS lcl_app IMPLEMENTATION
    class lcl_app implementation.
      method constructor.
        select * into table imara from mara up to  100 rows
                     where matnr in im_matnr.
        check sy-subrc = 0.
      endmethod.
    endclass.
    data: myapp type ref to lcl_app.
    select-options: s_matnr for mara-matnr.
    start-of-selection.
      create object myapp
            exporting
                 im_matnr = s_matnr[].
    Welcome to SDN!.  Be sure to award points for helpful answers and mark your post as solved when solved completely.  Thanks.
    REgards,
    Rich Heilman

  • Most urgent:::: passing parameter list  to reports containing record groups

    hi
    can any one help me , i am getting frm-41214 when i pass a paramter list containing record group as data parameter to run_report_object as parameter, calling report from forms 10g, but when i dont pass the parameter list the report runs displaying no data(as it should do), otherwise it dont run and display the frm-41214
    zulfiqar

    Hi!
    To suppress Oracle Reports native Parameter Form just add:
    add_parameter( pl_id, 'pARAMform', text_parameter, 'NO' );
    Andrew Velichko
    Brainbench MVP for Oracle Developer 2000 http://www.brainbench.com
    null

  • [Forum FAQ]How do I add a search feature in the parameter with long drop down list?

    Introduction
    There is a scenario that thousands of values in the drop-down of a parameter. Scrolling through the large drop down list is slow and cumbersome. Is there a way that we add a search feature in the report, so that it can filter down the values in the drop
    down list to a smaller list of values?
    Solution
    To achieve this requirement, we can add a parameter with multiple keywords ahead, then all of available values which are begin with the keyword will display in the parameter list. In this scenario, we can create cascading parameters. One is a keyword parameter,
    and the other parameter is based on the keyword to display the available values.
    In order to enable the user to type multiple keywords, we can use the query below to create a split function which takes the list and the de-limiter as input parameters and splits all the values in the database:
    CREATE FUNCTION [dbo].[SplitParameterValues] (@InputString NVARCHAR(max), @SplitChar VARCHAR(5))
     RETURNS @ValuesList TABLE
     param NVARCHAR(255)
     AS
     BEGIN
     DECLARE @ListValue NVARCHAR(max)
     SET @InputString = @InputString + @SplitChar
     WHILE @InputString!= @SplitChar
     BEGIN
     SELECT @ListValue = SUBSTRING(@InputString , 1, (CHARINDEX(@SplitChar, @InputString)-1))
     IF (CHARINDEX(@SplitChar, @InputString) + len(@SplitChar))>(LEN(@InputString))
     BEGIN
     SET @InputString=@SplitChar
     END
     ELSE
     BEGIN
     SELECT @InputString = SUBSTRING(@InputString, (CHARINDEX(@SplitChar, @InputString) + len(@SplitChar)) , LEN(@InputString)-(CHARINDEX(@SplitChar, @InputString)+ len(@SplitChar)-1) )
     END
    INSERT INTO @ValuesList VALUES( @ListValue)
     END
     RETURN
     END
    Use the query below create a stored procedure to return all available values for Account parameter:
    create PROCEDURE sp (@keyword nvarchar(50))
    AS
    SELECT     AccountDescription
    FROM         DimAccount d
    inner join (SELECT [param] FROM SplitParameterValues (@keyword,',')) s on d.AccountDescription like (s.[param]+'%')
    In Report Designer, select Stored Procedure as the Query type for DataSet1, then select or type sp in the drop-down list as below:
    By default, there is a parameter named keyword in the Parameters pane.
    Add a multi-value parameter named Account in the report, then select “Get values from a query” option for Available Values as below:
    Report Design and Report Preview surface
    Report Design:
    Report Preview:
    References:
    Create User-defined Functions (Database Engine)
    Adding Cascading Parameters (SSRS)
    Applies to
    Reporting Services 2005
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hmmm. This didn't work. I even re-booted, and Firefox still doesn't show the search engine.
    It was actually an update to an earlier engine, and I foolishly removed the old version rather than just updating it.
    Is there anything elsewhere (eg. the registry) that might be preventing this?

  • Ther are PARAMETER LIST DISCREPANC​IES in the help file vs the NIDAQ.H header file for GPCTR_Read​_Buffer...

    PROBLEM: The function help file contains documentation for using GPCTR_Read_Buffer with 7 parmeters in the parameter list. The NADAQ.H Header file contains 8 parameters in the function declaration. Which is right? What is the correct parameter list and can an example be provided that shows how to use the function correctly? I am currently using DAQ ver 6.92 and a 6602 Counter Timer board in a buffered start/stop or ND_BUFFERED_TWO_SIGNAL_EDGE_SEPARATION_MSR application.

    Thanks for the response Filipe, I'll let you know how it goes. I only went into the header file because example code provided by NI ... paste ...
    iStatus = GPCTR_Read_Buffer(iDevice, ulGpctrNum, ND_READ_MARK, ulReadOffset, ulNumPtsToRead, ulTimeOut, &ulNumPtsRead, pulReadBuf);
    showed use of 8 parameters - in agreement with the header file and in disagreement with the on-line help file function documentation.
    Tom

  • How and where should I create a parameter list

    Hi, I4m trying to create a parameter lists but I don4t know where and how.
    I guess as a program unit but as function or procedure, sorry I4m new on this for that I4m finding this a bit difficult. Please, someone could help me to understand this:
    PROCEDURE Run_Emp_Report IS
    pl_id ParamList;
    BEGIN
    ** Check to see if the 'tmpdata' parameter list exists.
    pl_id := Get_Parameter_List('tmpdata');
    ** If it does, then delete it.
    IF NOT Id_Null(pl_id) THEN
    Destroy_Parameter_List( pl_id );
    END IF;
    ** Create the 'tmpdata' parameter list afresh.
    pl_id := Create_Parameter_List('tmpdata');
    ** Add a data parameter to this parameter list that will
    ** establish the relationship between the named query
    ** 'EMP_QUERY' in the report, and the record group named
    ** 'EMP_RECS' in the form.
    Add_Parameter(pl_id,'EMP_QUERY',DATA_PARAMETER,'EMP_RECS');
    **Pass a Parameter into PARAMFORM so that a parameter dialog
    will not appear
    **for the parameters being passing in.
    Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
    ** Run the report synchronously, passing the parameter list
    Run_Product(REPORTS, 'empreport', SYNCHRONOUS, RUNTIME,
    FILESYSTEM, pl_id, NULL);
    END;

    Hi,
    What you've pasted the code here is absolutely correct.
    You'll have to write the code in Forms builder.
    You can either paste the same code in a procedure & call that procedure
    from button's When-Button-Pressed trigger or paste the code in
    your button's When-Button-Pressed trigger like this :
    DECLARE
    pl_id ParamList;
    BEGIN
    ** Check to see if the 'tmpdata' parameter list exists.
    pl_id := Get_Parameter_List('tmpdata');
    Run_Product(REPORTS, 'empreport', SYNCHRONOUS, RUNTIME,
    FILESYSTEM, pl_id, NULL);
    END;
    However, don't write the code in a function as you will need to return some value from the function.
    Thanks,
    Mayur Shah
    [email protected]

Maybe you are looking for