What exactly is a wrapper class?

In so far as Integer, Byte, Double et al. are concerned I understand that those wrapper classes are a way to handle primitive types as objects. But I've come across references to wrapper classes in documentation and other technical articles and I don't think I really understand what they are really used for. Why do you need a wrapper class for an object?
Could someone shed me some light on this issue?
Thanks,
John

An instance of a wrapper class holds a pointer to and instance of some other class or interface and provides access to it, typically supplying methods equivalent to all the methods of the underlying type.
The basic wrapper class a functional replacement for the underlying object.
When you're passed an object from some code outside your control you often don't know what exact class it is, or have access to it's class definition.
A wrapper object allows you to modify the functionality of such an object. You can extend the wrapper class, for example, adding extra methods. Or you can modify the methods, for example to provide logging of calls made.
As a concrete example, I have a wrapper class LoggedConnection which wraps a java.sql.Connection object. It also implements java.sql.Connection. If you ask a LoggedConnection for a Statement or PreparedStatement it fetches the appropriate object and returns a wrapped version which logs the SQL and the execution times etc..
My "get me a connection" routine can return either a raw Connection or a LoggedConnection according to whether a SQL log file is provided.
The main program doesn't need to know if it's using a genuine Connection object or the wrapped version.
Part of the definition would look like:
public class LoggedConnection implements Connection {
  private Connection wrappee;
  public LoggedConnection(Connection con) {
    wrapee = con;
  public createStatement() throws SQLExeception {
    return new LoggedStatement(wrappee.createStatement())
}(Of course this was tedious to write by hand because Connection has so many methods, all of which the wrapper must implement. Later I wrote a java program to generate Wrapper classes).

Similar Messages

  • What are the uses of Void wrapper class?

    Hi,
    Similar to other Wrappers, Void is a wrapper class for the primitive ' void ' . We all know that Void is a final class , we can't instantiate it.
    My Question is what are the uses of Void?
    thanks,

    kajbj wrote:
    I have at times used it in reflection and jmx.I have used them with SwingWorker if I didn't have anything interesting to return. There is also an example in the tutorial: [http://java.sun.com/docs/books/tutorial/uiswing/concurrency/simple.html]

  • What is the exact mean of  classname.class.

    what is the exact mean of classname.class. what situations it will be use ful . how to use . give me one example .

    Each class, interface, or enum loaded into the JVM has an associated Class object. This contains a lot of information about the class in question, including lists of fields and methods. <classname>.class gives you a reference to the Class object of the class mentioned.
    See the java.lang.Class javadocs for all the things you can do with a Class object.
    For example:
    theImage = new ImageIcon(MainClass.class.getResource("item.png"));to retrieve an image file from the directory containing the MainClass class file.

  • What is the advantage of using Wrapper Classes ?

    Hi friends,
    I am happy to join Java/J2EE tech. My project is scaled over the network. MVC-II struts, EJB based architecture, we are using.
    We are asked to use Wrapper Classes in in Java programs and not the primitive data types. I could not understand the reason.
    Pls tell me what is the advantage of using Wrapper Classes over the primitive data types ?
    means Integer instead of int, etc....

    Hi friends,
    I am happy to join Java/J2EE tech. My project is
    scaled over the network. MVC-II struts, EJB based
    architecture, we are using.
    We are asked to use Wrapper Classes in in Java
    programs and not the primitive data types. I could
    not understand the reason.
    Pls tell me what is the advantage of using Wrapper
    Classes over the primitive data types ?
    means Integer instead of int, etc....I am not sure why use Integer over int; but Wrapper classes are used to remove coupling between classes and create one hand doesn't know what the other hand does effect.
    for example:
    when you have a SFTP java package but doesn't do everything that your application needs to do in one step and you need to do sftp stuff at many places in your application, it would be wise not to use SFTP java package directly from all the classes that need to do sftp stuff. Because if you were to change the SFTP package later due to say some bug fix or newer version or ... you would have to go and modify all the classes that had sftp stuff to update.
    Instead you could write a custom sftp wrapper that handles all the sftp stuff for your application needs and that wrapper deals with the SFTP java package. So all the classes don't need to know which SFTP java package is being used only the custom-wrapper needs to know.

  • What is a wrapper Class

    Could someone please explain to me what a wrapper class is in Java. I have tried the net, but to no avail.
    Thanks

    sometimes the term is also used to refer to glue code, which adds no functionality but allows existing code to be used in a new place.
    For example, an anonyous inner classs used to invoke an existing class's functionality as an event handler, is sometimes referred to as a wrapper class.

  • What is meant by a wrapper class ?

    What is meant by a wrapper class ?

    java uses simple types such as int and char. these data type r not part of object hierarchy. they r passed by value to methods and cannot b directly passed by reference. there is no way for 2 methods to refer to the same instance of an int. at times u will need an object representation for one of these simple types.wrapper classes encapsulate or wrap the simple types within a class. thus, they r commonly referred to as type wrapper.
    java provides classes that correspond to each of the simple types

  • What are Wrapper classes and what are they used for ?

    What are Wrappter classes and what are they used for ?..Also, any examples would be great to understand this concept

    Wrapper classes are used to enclose primitive data
    types so that they can be used in instances where an
    object is required. For example, if you want to add an
    integer to an ArrayList, you can't use this:java.util.List al = new ArrayList();
    int i=123;
    al.add(i);because the ArrayList expects data of type object. In
    order to all the integer to the ArrayList, you must wrap
    it in the Integer wrapper class. This works:java.util.List al = new ArrayList();
    int i=123;
    al.add(new Integer(i));Hope that helps.
    Mark

  • Wrapper class ?? what that ??

    please anybody could give me an example of utilisation of a "wapper class" ? (I don t know what is this)
    thanks....

    then the next (and the main) question is :
    I am displaying a frame which contains canvas. when I invoc the method g1.drawRenderedImage (from api Java Advancing Imaging), the console java prints the message :
    could not find mediaLid Accelerator Wrapper Classes. Continuing in pure java mode
    do you thing that the problem is that there isnt any Keystroke ?
    thanks....

  • What is the proper way to code a "wrapper" class?

    Basically I want to replace an existing Action with a custom Action, but I want the custom Action to be able to invoke the existing Action.
    The following code works fine. I can create a custom Action using the existing action and the text on the button "paste-from-clipboard" is taken from the existing Action. So everything works great as long as the existing Action extends from AbstractAction.
    However the Action interface does not support the getKeys() method which I used to copy the key/value information from the existing action to the wrapped action. So if you try to create a button from some class that strictly implements the Action interface the key/value data in the wrapped Action will be empy and no text will appear on the button.
    So as the solution I thought I would need to override all the methods in the wrapped Action class to invoke the methods from the originalAction object. That is why all the commented code in the class is there. But then the protected methods cause a problem as the class won't compile.
    Do I just not worry about overriding those two methods? Is this a general rule when creating wrapper classes, you ignore the protected methods?
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class WrappedAction extends AbstractAction
         private Action originalAction;
         public WrappedAction(JComponent component, KeyStroke keyStroke)
              Object key = getKeyForActionMap(component, keyStroke);
              if (key == null)
                   String message = "no input mapping for KeyStroke: " + keyStroke;
                   throw new IllegalArgumentException(message);
              originalAction = component.getActionMap().get(key);
              if (originalAction == null)
                   String message = "no Action for action key: " + key;
                   throw new IllegalArgumentException(message);
              //  Replace the existing Action with this class
              component.getActionMap().put(key, this);
              //  Copy key/value pairs to
              if (originalAction instanceof AbstractAction)
                   AbstractAction action = (AbstractAction)originalAction;
                   Object[] actionKeys = action.getKeys();
                   for (int i = 0; i < actionKeys.length; i++)
                        String actionKey = actionKeys.toString();
                        putValue(actionKey, action.getValue(actionKey));
         private Object getKeyForActionMap(JComponent component, KeyStroke keyStroke)
              for (int i = 0; i < 3; i++)
              InputMap inputMap = component.getInputMap(i);
              if (inputMap != null)
                        Object key = inputMap.get(keyStroke);
                        if (key != null)
                             return key;
              return null;
         public void invokeOriginalAction(ActionEvent e)
              originalAction.actionPerformed(e);
         public void actionPerformed(ActionEvent e)
              System.out.println("custom code here");
              invokeOriginalAction(e);
         public void addPropertyChangeListener(PropertyChangeListener listener)
              originalAction.addPropertyChangeListener(listener);
         protected Object clone()
              originalAction.clone();
         protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
              originalAction.firePropertyChange(propertyName, oldValue, newValue);
         public Object[] getKeys()
              return originalAction.getKeys();
         public PropertyChangeListener[] getPropertyChangeListeners()
              return originalAction.getPropertyChangeListeners();
         public Object getValue(String key)
              return originalAction.getValue(key);
         public boolean isEnabled()
              return originalAction.isEnabled();
         public void putValue(String key, Object newValue)
              originalAction.putValue(key, newValue);
         public void removePropertyChangeListener(PropertyChangeListener listener)
              originalAction.removePropertyChangeListener(listener);
         public void setEnabled(boolean newValue)
              originalAction.setEnabled(newValue);
         public static void main(String[] args)
              JTextArea textArea = new JTextArea(5, 30);
              JFrame frame = new JFrame("Wrapped Action");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.add(new JScrollPane(textArea), BorderLayout.NORTH);
              frame.add(new JButton(new WrappedAction(textArea, KeyStroke.getKeyStroke("control V"))));
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.setVisible( true );

    I can't get the PropertyChangeListener to fire with any source. Here is my test code. Note I am able to add the PropertyChangeListener to the "Paste Action", but I get no output when I add it to the WrappedAction. I must be missing something basic.
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    public class WrappedAction3 implements Action, PropertyChangeListener
         private Action originalAction;
         private SwingPropertyChangeSupport changeSupport;
          *  Replace the default Action for the given KeyStroke with a custom Action
         public WrappedAction3(JComponent component, KeyStroke keyStroke)
              Object actionKey = getKeyForActionMap(component, keyStroke);
              if (actionKey == null)
                   String message = "no input mapping for KeyStroke: " + keyStroke;
                   throw new IllegalArgumentException(message);
              originalAction = component.getActionMap().get(actionKey);
              if (originalAction == null)
                   String message = "no Action for action key: " + actionKey;
                   throw new IllegalArgumentException(message);
              //  Replace the existing Action with this class
              component.getActionMap().put(actionKey, this);
              changeSupport = new SwingPropertyChangeSupport(this);
            originalAction.addPropertyChangeListener(this);
            addPropertyChangeListener(this);
          *  Search the 3 InputMaps to find the KeyStroke binding
         private Object getKeyForActionMap(JComponent component, KeyStroke keyStroke)
              for (int i = 0; i < 3; i++)
                  InputMap inputMap = component.getInputMap(i);
                  if (inputMap != null)
                        Object key = inputMap.get(keyStroke);
                        if (key != null)
                             return key;
              return null;
         public void invokeOriginalAction(ActionEvent e)
              originalAction.actionPerformed(e);
         public void actionPerformed(ActionEvent e)
              System.out.println("actionPerformed");
    //  Delegate the Action interface methods to the original Action
         public Object getValue(String key)
              return originalAction.getValue(key);
         public boolean isEnabled()
              return originalAction.isEnabled();
         public void putValue(String key, Object newValue)
              originalAction.putValue(key, newValue);
         public void setEnabled(boolean newValue)
              originalAction.setEnabled(newValue);
         public void xxxaddPropertyChangeListener(PropertyChangeListener listener)
              originalAction.addPropertyChangeListener(listener);
         public void xxxremovePropertyChangeListener(PropertyChangeListener listener)
              originalAction.removePropertyChangeListener(listener);
         public void addPropertyChangeListener(PropertyChangeListener listener)
            changeSupport.addPropertyChangeListener(listener);
        public void removePropertyChangeListener(PropertyChangeListener listener)
            changeSupport.removePropertyChangeListener(listener);
         public void propertyChange(PropertyChangeEvent evt)
             changeSupport.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
         public static void main(String[] args)
              JTable table = new JTable(15, 5);
              WrappedAction3 action = new WrappedAction3(table, KeyStroke.getKeyStroke("TAB"));
              action.addPropertyChangeListener( new PropertyChangeListener()
                   public void propertyChange(PropertyChangeEvent e)
                        System.out.println(e.getSource().getClass());
              action.putValue(Action.NAME, "name changed");
              Action paste = new DefaultEditorKit.PasteAction();
              paste.addPropertyChangeListener( new PropertyChangeListener()
                   public void propertyChange(PropertyChangeEvent e)
                        System.out.println(e.getSource().getClass());
              paste.putValue(Action.NAME, "name changed");
    }

  • Failed to Generate Wrapper Class Error With Postgresql

    Hello,
    Sorry if this comes across twice, I posted it first through the Google Groups interface, but I haven't seen it show up on the dev2dev forum interface. So here it is again.
    I've read the following threads that seem to be related to this
    question:
    http://groups-beta.google.com/group/weblogic.developer.interest.jdbc/browse_thread/thread/dc8f0a9ee03e9b9f/f0a70a673db3bb52
    http://groups-beta.google.com/group/weblogic.developer.interest.jdbc/browse_thread/thread/4f3b71c77dca30c4/4ed2e1c7b76a0c7b
    I also followed the links in the second post ( I also found them via
    Google as well ). I've been very sure the Postgresql JDBC driver is
    definitely in the class path. I'm able to load it with Class.forName()
    from a JSP page and then use DriverManager to get a connection that
    works. So that definitely means the driver is found.
    What else can cause this?
    The only really odd thing I am doing is running Weblogic on OS X,
    10.3.7 with all the updates. I know that this Weblogic setup works
    since I work on Oracle all day (using the provided Weblogic driver in
    8.1SP3). Just when I try to create a Postgresql connection for testing
    our app against Postgresql.
    I've tried it on Windows with Weblogic 8.1SP3 and it works, so I know
    Weblogic is capable of using this driver.
    My exact stacktrace is:
    java.lang.RuntimeException: Failed to Generate Wrapper Class
    at
    weblogic.utils.wrapper.WrapperFactory.createWrapper(WrapperFactory.java:183)
    at
    weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper(JDBCWrapperFactory.java:171)
    at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:248)
    at weblogic.jdbc.pool.Driver.connect(Driver.java:164)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:507)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:139)
    at
    weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:305)
    at jsp_servlet.__direct._jspService(direct.jsp:13)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:463)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    at weblogic.jdbc.jts.Driver.wrapAndThrowSQLException(Driver.java:458)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:511)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:139)
    at
    weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:305)
    at jsp_servlet.__direct._jspService(direct.jsp:13)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:463)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    What is going on at the place where this crashes? Is there a way find
    out what class it really can't find?
    Thanks,
    Patrick

    Patrick,
    1. Could you try to test the postgress connection pool using
    "Test Connection" on the pool set up page?
    2. Could you compare config.xml for broken and working installations
    in part of the connection pool settings?
    Regards,
    Slava Imeshev
    "Patrick Burleson" <[email protected]> wrote in message
    Sorry if this comes across twice, I posted it first through the Google Groups interface, but I haven't seen it show up on thedev2dev forum interface. So here it is again.
    >
    I've read the following threads that seem to be related to this
    question:
    http://groups-beta.google.com/group/weblogic.developer.interest.jdbc/browse_thread/thread/dc8f0a9ee03e9b9f/f0a70a673db3bb52
    http://groups-beta.google.com/group/weblogic.developer.interest.jdbc/browse_thread/thread/4f3b71c77dca30c4/4ed2e1c7b76a0c7b
    I also followed the links in the second post ( I also found them via
    Google as well ). I've been very sure the Postgresql JDBC driver is
    definitely in the class path. I'm able to load it with Class.forName()
    from a JSP page and then use DriverManager to get a connection that
    works. So that definitely means the driver is found.
    What else can cause this?
    The only really odd thing I am doing is running Weblogic on OS X,
    10.3.7 with all the updates. I know that this Weblogic setup works
    since I work on Oracle all day (using the provided Weblogic driver in
    8.1SP3). Just when I try to create a Postgresql connection for testing
    our app against Postgresql.
    I've tried it on Windows with Weblogic 8.1SP3 and it works, so I know
    Weblogic is capable of using this driver.
    My exact stacktrace is:
    java.lang.RuntimeException: Failed to Generate Wrapper Class
    at
    weblogic.utils.wrapper.WrapperFactory.createWrapper(WrapperFactory.java:183)
    at
    weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper(JDBCWrapperFactory.java:171)
    at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:248)
    at weblogic.jdbc.pool.Driver.connect(Driver.java:164)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:507)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:139)
    at
    weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:305)
    at jsp_servlet.__direct._jspService(direct.jsp:13)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:463)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    at weblogic.jdbc.jts.Driver.wrapAndThrowSQLException(Driver.java:458)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:511)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:139)
    at
    weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:305)
    at jsp_servlet.__direct._jspService(direct.jsp:13)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:463)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    What is going on at the place where this crashes? Is there a way find
    out what class it really can't find?
    Thanks,
    Patrick

  • Why to use wrapper class?

    hello,
    can anybody please tell me why wrapper class are used in JAVA and what are exactly wrapper class?
    reply me soon....

    I want to give an example and then explain why it is for. Primitives will be good example for this situation.
    Example:
    Below are the primitive types and their wrapper classes...
    Primitive to Wrapper Class
    byte - Byte
    short - Short
    int - Integer
    long - Long
    char - Character
    float - Float
    double - Double
    boolean - Boolean
    USING OBJECT CREATION
    Think a situation when you create an integer object using this code:
    ---> Integer intVar = new Integer();
    you have the methods and constants:
    1 MAX_VALUE ,
    2 MIN_VALUE ,
    3 byteValue() ,
    4 compareTo(Integer anotherInteger) ,
    5 compareTo(Object o) ,
    6 decode(String nm) ,
    7 doubleValue() ,
    8 equals(Object obj) ,
    9 floatValue() ,
    10 getInteger(String nm) ,
    11 getInteger(String nm, int val) ,
    12 getInteger(String nm, Integer val) ,
    13 hashCode() ,
    14 intValue() ,
    15 longValue() ,
    16 parseInt(String s) ,
    17 parseInt(String s, int radix) ,
    18 shortValue() ,
    19 toBinaryString(int i) ,
    20 toHexString(int i) ,
    21 toOctalString(int i) ,
    22 toString(),
    23 toString(int i) ,
    24 toString(int i, int radix) ,
    25 valueOf(String s) ,
    26 valueOf(String s, int radix)
    now you have an object with 2 constants and 24 methods.
    USING WRAPPER CLASS
    and think using wrapper class of Integer..
    CODE ---> int intVar = Integer.parseInt((String)someStringData);
    In this case your Integer object have the methods and constants
    1 MAX_VALUE ,
    2 MIN_VALUE ,
    3 parseInt(String s) ,
    4 parseInt(String s, int radix) ,
    5 toBinaryString(int i) ,
    6 toHexString(int i) ,
    7 toOctalString(int i) ,
    8 toString(int i) ,
    9 toString(int i, int radix) ,
    10 valueOf(String s) ,
    11 valueOf(String s, int radix)
    as you in this situation you have 2 constants and 9 methods.
    AS YOU SEE THERE ARE 15 METHODS DIFFERENCE FROM THE OBJECT AND THE WRAPPER CLASS OF INTEGER OBJECT.
    NOW TALKING ABOUT PRIMITIVE TYPES ALL PROGRAMMERS USED THIS TYPES FOR THEIR CODES AND THEY ALWAYS NEED SOME THIS KIND OF CASTING. IN MY EXAMPLE I TAKE THE VALUE OF AN STRING VARIABLE. AND THERE ARE LOTS OF THINGS SIMILIAR TO THIS EXAMPLE.
    IDEA OF THIS WRAPPER CLASSES IS THAT USE AS YOU NEED NOTHING MORE. IN THE WRAPPER CLASS YOU DONT HAVE INTEGER OBJECT. YOU ONLY NEED THE PARSEINT METHOD OF INTEGER OBJECT INSTEAD OF CREATING THE INTEGER OBJECT YOU USE THE WRAPPER CLASS OF THIS TYPE...
    OBJECTS ARE STORED IN A MEMORY PLACE CALLED HEAP WHICH IS PLACED ON RAM AND GARBAGING OF THIS OBJECTS TAKES MORE TIME TO ALLOCATE FROM HEAP STORAGE.
    AND ANOTHER NOTE FOR THIS WRAPPER CLASSES if you want to store an int inside a container such as an ArrayList (which takes only Object references), you can wrap your int inside the standard library Integer class
    EX:
    import java.util.*;
    public class ImmutableInteger {
    public static void main(String[] args) {
    List v = new ArrayList();
    for(int i = 0; i < 10; i++)
    v.add(new Integer(i));
    // But how do you change the int inside the Integer?
    } ///:~
    GOOD LUCK...
    REALKINGTA....

  • What exactly is InheritableThreadLocal Storage, and how exactly do I use it

    What exactly is InheritableThreadLocal Storage, and how exactly do I use it?

    What exactly is InheritableThreadLocal Storage, andI have only seen one previous use of ThreadLocal objects and it was somewhere on http://www.javaworld.com on a solution to the Java double-checked locking problem.
    Roughly speaking, previously to Java1.2 you had two variable-type choices in Java. The first is a static variable that is the same across ALL instances of a class. The second was an instance variable, that is can be different in EVERY instance of a class. Java 1.2 introduced the ThreadLocal variable-type. If a variable type is ThreadLocal, then every running Thread may see a different value for the variable - essentially it is a Map of Threads to values.
    InheritableThreadLocal is finely different from ThreadLocal. They are almost identical excepting that if one Thread is spawned from another (ie. it is a "child" thread) then the value of the InheritableThreadLocal variable will be the same in the child Thread as the parent Thread.
    As to when it could be used, I'm not so sure (other than the no-brainer "when you want a variable to have different values in different Threads"). I'd be interested to hear about any instances where someone has used a variable such as this.
    how exactly do I use it?Carefully

  • IN MATERIAL MASTER RECORD WHAT IS THE USE OF CLASS TYPE(CLASSIFICATION VIEW

    Hi Guys,
    Can you please explain what are the different critiria to use different class type and what exactly meaning of the each class type with respect to Material classification.
    Any material available on this to study. Please give link.
    Thanks,
    Dhanu

    Hi,
    Purpose
    The classification system allows you to use characteristics to describe all types of objects, and to group similar objects in classes u2013 to classify objects, in other words, so that you can find them more easily later.
    You then use the classes to help you to find objects more easily, using the characteristics defined in them as search criteria. This ensures that you can find objects with similar or identical characteristics as quickly as possible.
    Integration
    The classification system allows you to classify all types of object. First, you must define certain settings in Customizing for the classification system. For more information, see Customizing for the Classification System.
    SAP has predefined a number of object types (for example, materials, and equipment). The settings for these object types have already been defined in Customizing, so you can start to set up your classification system for these object types without defining further settings.
    Features
    Before you can use classification functions, you need to set up your classification system.
    The there are three steps to setting up a classification system:
    Defining the Properties of Objects
    You use characteristics to describe the properties of objects. You create characteristics centrally in the SAP R/3 System.
    See the SAP Library, Characteristics (CA-CL-CHR).
    Creating Classes
    You need classes to classify objects. These classes must be set up. During set up you must assign characteristics to the classes.
    Assigning Objects
    Once you have created the classes you require for classification, you can assign objects to these classes. You use the characteristics of the class to describe the objects you classify.
    This completes the data you require to use your classification system. You can then use your classification system to find objects that match the criteria you require.
    Once you have set up the classification system you can use it to find certain objects. To do this:
    Find a class in which objects are classified
    Find the object(s) you require in the class
    When you use classification to find objects, you use the characteristics as search criteria, and the system compares the values you enter with the values of the classified objects.
    Uts
    Award if helpfull

  • What exactly are Field symbols?

    Hi SDN,
    What exactly are Field symbols?
    I have read they are not pointers then what are they?
    Regards,
    Rahul

    Hi
    see this
    Field Symbols
    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
    Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
    All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
    Field symbols provide greater flexibility when you address data objects:
    If you want to process sections of fields, you can specify the offset and length of the field dynamically.
    You can assign one field symbol to another, which allows you to address parts of fields.
    Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    You can also force a field symbol to take different technical attributes from those of the field assigned to it.
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
    check the below links u will get the answers for your questions
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
    Syntax Diagram
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Extras:
    1. ... TYPE type
    2. ... TYPE REF TO cif
    3. ... TYPE REF TO DATA
    4. ... TYPE LINE OF type
    5. ... LIKE s
    6. ... LIKE LINE OF s
    7. ... TYPE tabkind
    8. ... STRUCTURE s DEFAULT wa
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
    Effect
    This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
    You can only use one of the additions.
    Example
    Output aircraft type from the table SFLIGHT using a field symbol:
    FIELD-SYMBOLS <PT> TYPE ANY.
    DATA SFLIGHT_WA TYPE SFLIGHT.
    ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... TYPE type
    Addition 2
    ... TYPE REF TO cif
    Addition 3
    ... TYPE REF TO DATA
    Addition 4
    ... TYPE LINE OF type
    Addition 5
    ... LIKE s
    Addition 6
    ... LIKE LINE OF s
    Addition 7
    ... TYPE tabkind
    Effect
    You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
    This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
    In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
    The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
    Example
    Address components of the flight bookings table SBOOK using a field symbol:
    DATA SBOOK_WA LIKE SBOOK.
    FIELD-SYMBOLS <SB> STRUCTURE SBOOK
    DEFAULT SBOOK_WA.
    WRITE: <SB>-BOOKID, <SB>-FLDATE.
    Regards
    Anji

  • What exactly does "Make AppleTalk Active" do?

    Hi,
    *System Preferences > Network > Ethernet > AppleTalk > Make AppleTalk Active*.
    I would like to know specifically/technically what exactly this option does?
    When connecting to OS X Macs, and Windows boxes publishing AppleTalk/AppleShare/AFP, there does not seem to be any need to have this option enabled.
    However, I am in an argument with a tech support guy at the moment, who is trying to claim that unless this option is enabled, connecting via AFP [1] is not true AFP...
    I know AppleTalk is a collection of protocols implemented in the 80s some time. And I know that AFP on Tiger is basically AppleShare over TCP/IP, and that AppleTalk over AppleTalk is not supported by Tiger.
    I suspect the Make AppleTalk Active option is somehow related to supporting AppleTalk sharing with old Mac systems, OS9,8,7 etc. But I really need to know exactly.
    Thanks.
    +[1] in this case, it is relating to sharing files between Tiger 10.4.10 systems and a Windows XP based RIP which is publishing some flavour of AppleShare.+

    Chris--
    My understanding is that AppleTalk is the protocol, like TCP/IP is a protocol. That's what this page implies to me:
    http://www.protocols.com/pbook/appletalk.htm
    So, at its inception, AppleTalk was a network transport protocol. There was a time when you could build an AppleTalk network without using TCP/IP, TCP/IP was only for the Internet (if you even knew what that was). You would just connect up some cables (not even ethernet, necessarily), and you'd get a network. It was pretty slow, but ethernet stuff was wicked expensive, so it didn't matter. AppleTalk handled the network transport, and AFP was a part of that.
    Sometime before OS 9 came out, Apple moved the AFP part to TCP/IP. AppleTalk was still available, mostly because of the legions of people who had old printers that only had AppleTalk (I know I was one of them until March of this year, when my LaserWriter Pro 600 gave up the ghost). If I had to guess I'd guess it's been almost ten years since they moved to AFP over TCP/IP. Certainly it was before OS 9.
    If you want to try connecting to the Windows Server via AppleTalk, you can try changing the URL in the dialog you get when you use the Finder's "Connect to Server..." menu item. I think, if I remember correctly, it takes this form:
    <pre class="command">afp://at/serveraddress:*/</pre>
    If that doesn't work, then take out one "/" after "afp:".
    charlie

Maybe you are looking for

  • Time Machine backup over wifi not working after upgrade to 10.6.3

    I have a firewire external hard disk connected to directly into my imac which I use for back-up. The imac is wired into an ethernet LAN. I also backup my MacBook Pro to the same hard disk. The MacBook is connected to the backup disk via a wifi link t

  • Skip Blank Values in Import-CSV

    I am attempting to do a mass import of user attributes (phone number, address, city, state, zip code, title, company). All goes well until I hit a blank value in the CSV. Here is the Powershell script I am trying to use. Import-Csv IA-Test2.csv | For

  • Error 1935 - An error occured during the installation assembly

    Every time I try to download Acrobat Reader 8.1.2 I get the following error message: Error 1935 - An error occured during the installation assembly. I have Microsoft Vista - Internet Explorer 7. I have a Dell computer.

  • Third party operated cross-dock

    Hi, How do I receive the material at the third party operated cross-dock? Please let me know if anyone knows the answer for this. Thank you. with regards, Muthu Ganapathy.

  • HP Mini 110-3800la, which Network Controller I have to download?

    Hi! Like a week ago, I formatted my computer and naturally, some drivers were missing. I restored the Network Adapter but the Network Controller driver is still missing. I tried to install two drivers but they didn't work, and reading through all tho