Advantages,Dis-advantages,when and where -use java.lang.Void Wrapper  class

Hi All,
I like to know when and where to use the wrapper class java.lang.Void and when it is particulary needed.if anyone could give me some examples it will be better.
Thanks in advance,
Kathir

I like to know when and where to use the wrapper class java.lang.VoidWhy? If you don't need it, you don't have to use it.
and when it is particulary needed.It is needed when you want to represent the concept of a void return value.
if anyone could give me some examples it will be better.
Method wait = Object.class.getMethod("wait",null);
if (wait.getReturnType() == Void.TYPE) {
  System.out.println("Object.wait() returns null");
}

Similar Messages

  • Using java.lang.reflect.Proxy class

    I am investigating the uses of the new Proxy object introduced in jdk1.3.
    One of the first things I noticed was how slow it was to generate a class via Proxy. The system can spend over 100 millliseconds to generate one. If you create many of those this can suck up alot of time. Is there a way to speed this up? I noticed when I try to cache the Object sent back into one of the java.util Collection I get errors when trying to retrieve them. Usually class cast errors when I call the 'isEmpty' method on the Collection.
    I noticed that I could cache them into an array of Objects, I have also been able to store the Class that is generated, and the Constructor, so when new ones were needed I could just call the constructor using the Class that was pre generated.
    In my performance tests it took in the order of 2 minutes to generate 100,000 without any cacheing.
    When I cached the objects in an [] of Objects that time went down to around 15 seconds. When I cached the Class and Constructor the time went to around 30 seconds.
    Has anyone out there attempted to cache Proxy's?
    I would appreciate any experience you have had with this.
    thanks in advance
    chris

    Cris,
    I am very interested in the caching approach you took. I have an application that uses a lot of proxies, any kind of optimization on proxies would result in a big performance boost.
    Thanks,
    David

  • When and Where and how to use Proxies

    hi
    New to Xi Can anyone explain When and Where and how to use Proxies
    Mohit

    Proxies: are interfaces which will get executed in the application system.They can be created only in the system from message interfaces using the proxy generation functions.
    The biggest advantage of the proxy is that it always by passes the Adapter Engine and will directly interact with the application system and Integration engine - so it will and should give us a better performance.
    The literal definition of a proxy is an object / process authorized to act for another; an agent or a substitute. In simpler terms, proxies in the XI context are objects used to encapsulate the creation (from a sender system) or parsing of XML (at a receiver system) as well as the communication with the relevant runtime components required to send or receive those messages. The Proxy Runtime controls these objects / processes, and can itself be controlled by the applications it communicates with.
    The Proxy currently has the following components available:
    1. ABAP Proxy – Communication using XI or Web Services
    2. Java Proxy– Communication using XI (J2EE)
    JAVA Proxies:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a068cf2f-0401-0010-2aa9-f5ae4b2096f9
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f272165e-0401-0010-b4a1-e7eb8903501d
    ABAP Proxies:
    /people/sap.user72/blog/2005/12/13/integration-builders-through-proxy-server-part--2
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    /people/arulraja.ma/blog/2006/08/18/xi-reliable-messaging-150-eoio-in-abap-proxies
    /people/stefan.grube/blog/2006/07/28/xi-debug-your-inbound-abap-proxy-implementation
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    /people/sukumar.natarajan/blog/2007/01/07/how-to-raise-alerts-from-abap-proxy
    /people/sravya.talanki2/blog/2006/07/28/smarter-approach-for-coding-abap-proxies
    ON SDN TV
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=abap%20proxy%20xi&cat=sdn_all&start=11#
    Proxies communicate with the XI server by means of native SOAP calls over HTTP .RFC does not, so you have to convert from SOAP to RFC calls and vice versa. So XML conversion is required.
    ABAP Proxies uses Webservice and Http Protocols. And if you use RFC it is mainly meant for Sync. call. But Proxies is used for both Sync and Async.
    If you use ABAP Proxy , you can reduce the overhead calling the function again and again.
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies - Activate Proxy
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies - ABAP Server Proxy
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy - ABAP Client Proxy
    Re: JDBC Sender select/update problem
    If u generate proxy for outbound interface then its client proxy and for inbound interface its server proxy.
    In client proxy u can call the method to send messages but u can't modify it but in server proxy its possible to write a user code within the method to execute proxy.
    CLIENT PROXY:
    A WSDL description from a UDDI server (or an Internet page) is usually used to make a service executable in the Internet and to describe the interface of this service. You require a client proxy and not a server proxy to call this service by using the Web service infrastructure.
    SERVER PROXY:
    You can only generate ABAP server proxies from a WSDL description if they originate in the Integration Repository.You can also generate server proxies for Java and client proxies for ABAP from message interfaces.

  • When we are using java.io.DataInputstream and method readInt()or read doubl

    Hi
    When we are using java.io.DataInputStream some garbage value is coming
    import java.io.*;
    class DataDemo
    public static void main(String ar[]) throws IOException
    DataInputStream dis=new DataInputStream(System.in);
    double d=dis.readDouble();
    System.out.print("ERRRRR"+d);
    when we input 234.66
    its printing 7.123096485547326E-67
    If anybody know why plz answer me
    Regards
    Rani

    DataInputStream(System.in);Why do you expect this to create a double? It doesn't, see the documentation for the method, you're misusing it.

  • How to use java.lang.Class.getMethod() and java.lang.reflect.Method.invoke(

    I want to call a specified method of one class dynamically. I use the method
    "getMethod()" in package "java.lang.Class" to get method and "invoke()" in
    " java.lang.reflect.Method " to invoke method.
    The problem is as following :
    1. There are two argument in this method "getMethod(String MethodName , Class[] paremterTypes)" in package "Class". I have no idea about the second parameter " Class[] parameterTypes ".what does the argument exactly mean ?
    2. There are two argument in the method "invoke(object obj, object[] obj)" in package "Method".
    I have no idea about the second parameter "object[] obj ".what is mean ?
    I pass " null " value to it and it works.But i pass anothers ,jvm will throw exception.

    I have a generic Method Executer that has a method like
    public Object execute(String className, String methodName, Object args)
        String fullClassName = packageName + className ;
        Class delegateClass = Class.forName(fullClassName);
        BaseDelegate delegate = (BaseDelegate)delegateClass.newInstance();
        Method method = null;
        if (args == null)
            method = delegateClass.getMethod(methodName, new Class[] {});
            obj = method.invoke(delegate,new Object[] {});
        else
            method = delegateClass.getMethod(methodName, new Class[] {args.getClass()});
            obj = method.invoke(delegate, new Object[]{args});
       }This seems to have problems when I call the method from a class like:
    execute("CategoryDelegate", "getCategoryById", new Integer(4144));(I get a NoSuchMethodException)
    The method I am trying to execute in CategoryDelegate looks like:
    public Category getCategoryById(int categoryId) throws DelegateExceptionI think it has to deal with the difference in the way we handle Primitive Wrappers and Objects. Wrapper we have to use Interger.TYPE and with the rest of the Objects we have to use obj.class.
    Am I doing something wrong here? Any suggestions to make it work for primitive wrappers as well as Objects?

  • What is JSF and where use it

    hi!
    i dont know what is jsf and where use it
    what different from JSTL
    thanks...

    At this level a visit to JSF-Tutorials (http://www.jsftutorials.net/) might the best thing to do. Or dig into a book.
    Basically it has a different scope than JSTL.
    JSF is a presentation layer framework. Other names in that area are:
    Struts, Spring MVC, Tapestry, and many more
    JSTL is a collection of JSP-tags and therefor covers only a VERY small part of the presentation layer. And it is very far away from a framework
    hth
    Alexander

  • When and where IDOC is triggered for TCode MD04

    Please guide me when and where IDOC is triggered for TCode MD04. In my case it is triggering even though I am trying to save a PO with error or on hold.

    Hi,
    Idoc triggers when we save or change the PO. It depends on the message control settings in the partner profile. Check the message control settings.
    thanks
    sarvesh

  • How can i know when and where my iphone replaced and

    how can i know when and where my iphone repalced by new one

    Seriously? You had your phone replaced under warranty, & you have no idea where or when you did this?
    Well, no one here would have any idea. As a start, plug the SN in here:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • I have been getting java.lang.ClassNotFoundException: ZeroApplet.class and java.lang.ClassNotFoundException: JavaToJS.class crashes with JRE version 1.6.0_26-b03-384-10M3425 VM executing a Java Applet. Is Apple aware of this problem? No longer supported?

    My web page uses a Java Applet to allow my visitors to replay chess games; the Chess Viewer Deluxe applet was written by Nikolai Pilafov some time ago and has been working properly for some time (until recently). I don't monitor this part of my site regularly so I am not sure when it began to fail. On his web site [http://chesstuff.blogspot.com/2008/11/chess-viewer-deluxe.html] he has a link to check LiveConnect object functionality (which fails for OBJECT tags). His recommendation is to "seek platform specific support which might be available from the JRE developers for your platform".
    I have been getting java.lang.ClassNotFoundException: ZeroApplet.class and java.lang.ClassNotFoundException: JavaToJS.class crashes with JRE version 1.6.0_26-b03-384-10M3425 VM executing a Java Applet. Until I checked the LiveConnect object functionality, I was unable to identify the source of the console error messages. This does seem to be the smoking gun.
    Is Apple aware of this problem? Are these classes no longer supported? Has anyone else had this problem? You can attempt to recreate the problem locally by going to my web page: http://donsmallidge.com/DonSmallidgeChess.html
    Thanks in advance for any help you can provide!
    Abbreviated Java Console output:
    Java Plug-in 1.6.0_26
    Using JRE version 1.6.0_26-b03-384-10M3425 Java HotSpot(TM) 64-Bit Server VM
    load: class ZeroApplet.class not found.
    java.lang.ClassNotFoundException: ZeroApplet.class
        at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:211)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:144)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:662)
        at sun.applet.AppletPanel.createApplet(AppletPanel.java:807)
        at sun.plugin.AppletViewer.createApplet(AppletViewer.java:2389)
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
        at sun.applet.AppletPanel.run(AppletPanel.java:368)
        at java.lang.Thread.run(Thread.java:680)
    load: class JavaToJS.class not found.
    java.lang.ClassNotFoundException: JavaToJS.class
        at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:211)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:144)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:662)
        at sun.applet.AppletPanel.createApplet(AppletPanel.java:807)
        at sun.plugin.AppletViewer.createApplet(AppletViewer.java:2389)
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
        at sun.applet.AppletPanel.run(AppletPanel.java:368)
        at java.lang.Thread.run(Thread.java:680)

    I just went up to check the LiveConnect object functionality page AND IT WORKED THIS TIME! I must confess, this is very mysterious. I will do some more checking and reply here if I can determine why it is working now (and more importantly, why it didn't work before).

  • How to use Java.lang.Math to calculate; Advice programming

    Hi, all!
    I am trying to teach myself Java, and am using the MindQ CDs to do it. I'm dreadfully stuck on this one exercise, and I could use some help figuring out how to properly call a Math method, store the variables, and print the results. I've programmed other methods successfully before; for some reason I just can't figure this one out. I've tried about fifty different configurations; maybe I can get some good advice here? Thanks!
    import java.io.*;
    import java.util.Random;
    import java.lang.Math;
    public class JavaCalcs {
        public static void main(String args[]) {
            System.out.println("Starting JavaComputations...");
            //main method variable declarations
            int z, y, x, w;
            int A = -12;
            int B = 2;
            z = A & B;
            y = A | B;
            x = A >> B;
            w = A >>> B;
            System.out.println(z + ";" + y + ";" + x + ";" + w + ";");
            Random kickassRNG = new Random();
            double rDOne = kickassRNG.nextDouble() * 90.0;
            double rDTwo = kickassRNG.nextDouble() * 90.0;
            System.out.println("rDOne= " + rDOne);
            System.out.println("rDTwo= " + rDTwo);
    //NOTE-EVERYTHING WORKS FINE UNTIL THIS POINT...
            if (rDOne > rDTwo)
            System.out.println("The larger of the 2 degs. is rDOne");
            //compute ceiling.
            double a=rDOne; //Store the value of rDOne.
            public static double ceil(double a);
            return a;
            System.out.println( "the ceiling of rDOne is " + a );
            //convert degree measurement to radians.     
            public static double toRadians(double b);
            double b = a;
            System.out.println("rDOne in radians is " + b );
            //compute tangent of that result.
            public static double tan(double c);
            double c = b;
            System.out.println("The tangent of rDOne is " + c );
            else
            System.out.println("The larger of the 2 degs. is rDTwo");
            //compute ceiling.
            double a=rDTwo; //Store the value of rDOne.
            public static double ceil(double a);
            return a;
            System.out.println( "the ceiling of rDTwo is " + a );
            //convert degree measurement to radians.     
            public static double toRadians(double b);
            double b = a;
            System.out.println("rDTwo in radians is " + b );
            //compute tangent of that result.
            public static double tan(double c);
            double c = b;
            System.out.println("The tangent of rDTwo is " + c );
        } //end main method.
    }

    VERY useful link..thxYou're welcome. Here are some more:
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.

  • Cannot convert ÿØÿà of type class java.lang.String to class BFileDomain.

    Hi All,
    I am using Jdeveloper 11.1.2.3.0.
    I have a scenario of making an ADF page where I have a IMAGE field to show on the page. So,I have a table called "PRODUCT" with fields called photo with BFILE type. Now when I the data i have inserted using the DML command and i can see the path at the backend.
    However,when i am runnig my ADF page in the Filed called "PHOTO" I can only see a junk character stating 'yoyo'.
    When I click on it, it says ERROR "Cannot convert ÿØÿà of type class java.lang.String to class oracle.jbo.domain.BFileDomain".
    Your help will be appreciated ASAP.
    Regards,
    Shahnawaz

    Hi,
    did you show the id-value in the user interface as a input-component, and did the input-component include a converter?
    If yes, show the id as output-text and remove any existing converter-components.
    Best Regards

  • Cannot convert type class java.lang.String to class oracle.jbo.domain.Clob

    Cannot convert type class java.lang.String to class oracle.jbo.domain.ClobDomain.
    Using ADF Business Components I have a JSFF page fragment with an ADF form based on a table with has a column of type CLOB. The data is retrieved from the database and displayed correctly but when any field is changed and submitted the above error occurs. I have just used the drag and drop technique to create the ADF form with a submit button, am I missing a step?
    I am using the production release of Jdeveloper11G

    Reproduced and filed bug# 7487124
    The workaround is to add a custom converter class to your ViewController project like this
    package oow2008.view;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    import oracle.jbo.domain.DataCreationException;
    public class ClobConverter implements Converter {
         public Object getAsObject(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   String string) {
           try {
             return string != null ? new ClobDomain(string) : null;
           } catch (DataCreationException dce) {
             dce.setAppendCodes(false);
             FacesMessage fm =
               new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                "Invalid Clob Value",
                                dce.getMessage());
             throw new ConverterException(fm);
         public String getAsString(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   Object object) {
           return object != null ?
                  object.toString() :
                  null;
    }then to register the converter in faces-config.xml like this
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
      <application>
        <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
      </application>
      <converter>
        <converter-id>clobConverter</converter-id>
        <converter-class>oow2008.view.ClobConverter</converter-class>
      </converter>
    </faces-config>then reference this converter in the field for the ClobDomain value like this
              <af:inputText value="#{bindings.Description.inputValue}"
                            label="#{bindings.Description.hints.label}"
                            required="#{bindings.Description.hints.mandatory}"
                            columns="40"
                            maximumLength="#{bindings.Description.hints.precision}"
                            shortDesc="#{bindings.Description.hints.tooltip}"
                            wrap="soft" rows="10">
                <f:validator binding="#{bindings.Description.validator}"/>
                <f:converter converterId="clobConverter"/>
              </af:inputText>

  • Exception in thread "main" java.lang.NoClassDefFoundError: Emp/class

    Dear all,
    It occur 'Exception in thread "main" java.lang.NoClassDefFoundError: Emp/class' error when I test a oracle java sample.I've already SET CLASSPATH=C:\ORACLE\JDBC\LIB\CLASSE~1.ZIP.
    following is the source code:
    import java.sql.*;
    class Emp
    public static void main (String args [])
    throws SQLException
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Connect to the database
    // You must put a database name after the @ sign in the connection URL.
    // You can use either the fully specified SQL*net syntax or a short cut
    // syntax as <host>:<port>:<sid>. The example uses the short cut syntax.
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:oci8:@localhost:1521:orcl",
                        "scott", "tiger");
    // Create a Statement
    Statement stmt = conn.createStatement ();
    // Select the ENAME column from the EMP table
    ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
    // Iterate through the result and print the employee names
    while (rset.next ())
    System.out.println (rset.getString (1));
    Can you tell me what should also be set in classpath?
    thanks in advance.

    You are right, the program is absolutely correct and I've run it before.but why set PATH=%PATH%;C:\ORACLE\JDBC\LIB\CLASSE~1.ZIP?I don't think it is correct.
    I've ever run this jdbc program before and remeber only set classpath(path is also be set only for run executable program, for example set path=%path%;c:\j2sdk\bin),
    I think the only difference with before is:
    1,oracle version is changed from enterprise version to personal version
    2,OS is changed from NT to windows 98
    but i dont know if it lead to problem and can you give me some advice?

  • HELP!!! java.lang.ClassFormatError: (Truncated class file)

    Hello all,
    I'm writing a ClassLoader and the funniest things are happening. If I load a compiled class for the first time after compilation everything is ok. Once I change the class and recompile it, it starts putting out java.lang.ClassFormatError: (Truncated class file). If I alter the changes back to normal and recompile. It works again. Is there some sort of buffer which keeps the once loaded class in memory, even after rebooting?
    Please help, I'm at a loss
    Gideon

    hi dmbdmb,
    I got following error when try to run a java code in JBoss.
    15:39:56,696 ERROR [LogInterceptor] Unexpected Error:
    java.lang.ClassFormatError: Thilina (Truncated class file)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
    at com.sun.tools.javac.v8.StringCompiler$Loader.findClass(StringCompiler
    .java:63)
    at com.sun.tools.javac.v8.StringCompiler.executeMethodWithReturnType(Str
    ingCompiler.java:120)
    at cc.aot.qVoice.domain.ejb.qVoiceManager.qVoiceManagerEJB.getVxmlString
    (qVoiceManagerEJB.java:125)
    I use JBoss 3.0.6 and sdk 1.4. In my program, classes are create and load on the fly. Then using Reflection API I called some
    methods in the dynamically created class(this class not
    write into a file and it is taken as a String variable).
    I refferd this url as a guid to write class loader and compiler.(actually same thing i copied
    from there and change it's name Pmat1 to StringCompiler)
    http://forum.java.sun.com/thread.jsp?thread=347467&forum=4&message=1439418
    When I run this as a normal application, it is work well. Then I try to run it in a jboss and it will give the above error.
    In here I Wote some EJBs and struts also and i called the methodds in the StringCompiler(Pamat1) class in a EJB. Thilina is
    the name of the dynamically created calss and StringCompiler is the class that includes the class loader and compiler methods
    as in the above url. qVoiceManagerEJB has a getvxmlString method. Whithin this method
    i called required the methods in the String compiler.
    Can u some body help me. Thanx in advanced for any help.
    anjithalb

  • Problem with:error: java.lang.ClassFormatError: Truncated class file

    Hello, I created an simple applet writing "hello world". Now I would like to add *.class file to my serwer witch I've implemented on microcontroller P89C51RD2BN.
    Serwer is programmed with hex file which is created after compiling C source files. In this case I converted .class file to array in C (using hexedit program). When I am (using IE ) browsing my serwer Html site is loading corectly and *.class file is send from serwer also corectly (define arrays are transfered corectly) but applet is not initiated. When I am runnig Java console I can see this:
    error: java.lang.ClassFormatError: Truncated class file
    When I am runnig the same site with the same class file on my PC everything is ok.
    I would be greatfull for any help. Thx. (sorry for my English :P )

    Not too familiar with native compilation, which I believe you are trying to accomplish here. It would appear that you don't have any problems running your applet, more or less running it after being converted to legacy code. Try the "native methods" forum under "Fundementals/Key Classes", this may be helpful. Sorry for not being too helpful.

Maybe you are looking for

  • How do I update my studio creator from source 1.4 to 1.5

    every time I try to make a foreach loop this message follows for-each loops are not supported in -source 1.4 (try -source 1.5 to enable for-each loops) how can I get source 1.5

  • Nvidia card giving me same trouble as Ati card

    Okay, originally I was using a Radeon 9500 Pro video card.  The problem was that anything OGL accelerated completely froze my system; I couldn't run glxgears without it freezing.  I tried and tried and tried to find a solution to the problem, using t

  • Report Text line width

    Is there a way to set the text line width on a report to 80 characters and then have it wrap to the next line. I'm getting very long cells that I have to scroll over with the arrow key to see the text past my screen size.

  • Duplicate attachment in UWL workitems

    Hi Experts, We are having NW portal 7.3, SP08, Issue: Workitems in universal worklist are having duplicate attachment entries, this is not what is expected, as per requirement there must be only one entry visible one workitem, Please find below scree

  • Classic chimes

    My classic phone chimes 3 times at 09.00 and 12 noon. I have not set this and cannot see how to alter the times it chimes. It is not connected to the clock alarm. Any ideas please