Regarding Serializable and subclasses.

I have a an abstract parent class called 'Information'
which implements Serializable and which has an abstract
method called init().
There are 2 subclasses that extend the parent class Information
called SInformation_1 and SInformation_2 and implement the method init().
Now as the parent class is Serialized,will the concrete subclasses
also be Serializable?

How long does it take to write a demo?
import java.io.*;
abstract class Base implements Serializable {
    public abstract void init();
class D1 extends Base {
    public void init() {}
class D2 extends Base {
    public void init() {}
public class SerializableExample {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        Base obj1 = new D1();
        Base obj2 = new D2();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(baos);
        out.writeObject(obj1);
        out.writeObject(obj2);
        out.flush();
        out.close();
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream in = new ObjectInputStream(bais);
        D1 d1 = (D1) in.readObject();
        D2 d2 = (D2) in.readObject();
}

Similar Messages

  • Using serialize and deserialize methods generated by clientgen

    I am trying to use the classes generated by the weblogic.webservice.clientgen tool
    from the weblogic 8.1 release. I would like to be able to make direct use of
    the serialize and
    deserialize methods in the "Codec" classes that correspond to the various request
    and
    response object classes. However, these methods require SerializationContext
    and
    deserializationContext objects as inputs. Are these context objects things I
    can construct,
    manufacture and/or access? Are there any coding examples for using these methods?
    Thanks.
    Michael

    Bruce,
    Thanks for the response. I have seen the documentation before. What that shows
    me is how
    to write customized Serialize and Deserialize methods. What I want to do is call
    the ones that
    clientgen has already created for me. I would love to have these called by the
    internals of the
    generated code as part of the handling of service calls. My problem is that the
    web site
    that I'm calling for these services uses SSL, and every attempt to use the clientgen-generated
    services results in the following exception being raised:
    javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable
    certificate was received.
    Since I am successful in making SOAP calls to this same site -- certificate aren't
    an issue
    for these SOAP calls -- I thought that what I should try is to make the service
    calls myself
    using SOAP, but to use the generated Serialize and Deserialize methods
    to create the request body and process the response body surrounding the SOAP
    call.
    However, what I'd really like to do
    is figure out the cause of the SSLKeyException, and to make the service calls
    the way weblogic
    intended them to be made. So if you have any suggestions about what might
    be causing the exception, I'd appreciate the help.
    BTW. In addition to being able to make SOAP calls myself, I've also had some success
    making
    web service calls using code generated by Apache AXIS's wsdl2java tool and JWSDP's
    wscompile
    tool; however, neither of these wsdl processors are replacements for clientgen
    because they
    both have problems dealing with the complex structures described by wsdl files
    for the web
    services I'm trying to use.
    Bruce Stephens <[email protected]> wrote:
    Hi Michael,
    The De/SerializationContext are internal/private objects. The example
    in the doc (you have probably already seen) is a good starting point:
    http://e-docs.bea.com/wls/docs81/webserv/customdata.html#1052981
    Regards,
    Bruce
    BTW, Have you considered using XMLBeans?
    http://dev2dev.bea.com/technologies/xmlbeans/index.jsp
    Michael Horton wrote:
    I am trying to use the classes generated by the weblogic.webservice.clientgentool
    from the weblogic 8.1 release. I would like to be able to make directuse of
    the serialize and
    deserialize methods in the "Codec" classes that correspond to the variousrequest
    and
    response object classes. However, these methods require SerializationContext
    and
    deserializationContext objects as inputs. Are these context objectsthings I
    can construct,
    manufacture and/or access? Are there any coding examples for usingthese methods?
    Thanks.
    Michael

  • What is serialization and serializable

    what is serialization and serializable,Can any body explain me please.

    hi
    Serialization in java is the process of making the object flat which can later be stored on your disk like a normal flat file. the serailized object can be found useful mainly when using RMI and EJB where we persist cobjects so that they can be sent online (thru cable) by this we mean for objects to be distributed the prerequiste is tht they should be serialized. For this we have a interfacein java called "Serializable". the class tht needs serialization of its object should implement this class. this is a marker interface(the interface tht contains nmo methods)
    hope the concept is clear if not please mail me to : [email protected]
    bye
    thnx and regards
    bhaskara navuluri

  • The "always allow" button is grayed out in settings regarding cookies, and I can not find where to change the setting.  (Restrictions are not on.)

    The "always allow" button is grayed out in settings regarding cookies, and I can not find where to change the setting.  (Restrictions are not on.)  Do you know where I go to change the setting to allow me to "always allow" cookies?

    Hi lisaarnett111,
    If you are having issues turning on Always Allow for cookies in Safari on your iPad, you may want to check to make sure that you don't have Private Browsing enabled, as noted in the following article:
    Turn Private Browsing on or off on your iPhone, iPad, or iPod touch - Apple Support
    Regards,
    - Brenden

  • Question regarding selectOneMenu and PROCESS_VALIDATIONS(3) phase

    Hi im a bit lost regarding selectOneMenu and how validation phase all works together.
    The thing is that i have a simple selectOneMenu
    <h:form id="SearchForm">                                                  
         <h:panelGrid columns="3"  border="0">
              <h:outputLabel id="caseTypeText" value="#{msg.searchCaseCaseType}" for="caseType" />                         
              <h:selectOneMenu id="caseType" value="#{searchCaseBean.caseType}" style="width: 200px;" binding="#{searchCaseBean.caseTypeSelect}">     
                   <f:selectItem itemValue="" itemLabel="#{msg.CommonTextAll}" />                                             
                   <f:selectItems value="#{searchCaseBean.caseTypes}"  />                              
              </h:selectOneMenu>
              <h:message for="caseType" styleClass="errorMessage" />
              <h:panelGroup />
              <h:panelGroup />
              <h:commandButton action="#{searchCaseBean.actionSearch}" value="#{msg.buttonSearch}" />
         </h:panelGrid>
    </h:form>Now when i hit submit button i can see that the bean method searchCaseBean.caseTypes (used in the <f:selectItems> tag) is executed in the PROCESS_VALIDATIONS(3) phase. How come? I dont whant this method to be executed in phase 3, only in phase 6.
    If i add the this in the method if (FacesContext.getCurrentInstance().getRenderResponse())
    public List<SelectItem> getStepStatuses(){
         List<CaseStep> caseSteps = new ArrayList<CaseStep>();
         if (FacesContext.getCurrentInstance().getRenderResponse()) {
              caseSteps = getCaseService().getCaseStep(value);     
         List<SelectItem> selectItems = new ArrayList<SelectItem>(caseSteps.size());
         for(int i=0; i < caseSteps.size(); i++){
              CaseStep step = caseSteps.get(i);               
              String stepStatus = step.getStatus() + "_" + step.getSubStatus();           
              selectItems.add(new SelectItem(stepStatus, step.getShortName()));
         return selectItems;
    } Now i get a validation error (javax.faces.component.UISelectOne.INVALID) for the select field and only phase1, phase2, phase 3 and phase 6 is executed.
    Im lost?

    I see. Many thanxs BalusC. Im using your blog very often, and its very helpfull for me.
    I changed now to use the constructor load method instead. But know im getting problem of calling my service layer (Spring service bean). Its seems they havent been init when jsf bean is calling its constructor.
    Can i init the spring service bean from the faces-config file?
    JSF Bean
        public SearchCaseBean() {
              super();
                    //caseService need to be init
              if(getCaseService() == null){
                   setCaseService((CaseService)getWebApplicationContextBean("caseService"));
              fillCaseTypeSelectItems();
              fillCaseStatusSelectItems();
    .....faces-config
    <managed-bean>
              <managed-bean-name>searchCaseBean</managed-bean-name>
              <managed-bean-class>portal.web.SearchCaseBean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>          
              <managed-property>
                   <property-name>caseService</property-name>
                   <value>#{caseService}</value>
              </managed-property>
         </managed-bean>

  • Question regarding roaming and data usage

    I am currently out of my main country of service, and as such I have a question regarding roaming and data usage.
    I am told that the airplane mode is sufficient from keeping the phone off from roaming, but does this apply to any background data usage for applications and such?
    If the phone is in airplane mode, are all use of the phone including wifi and application use through the wifi outside of all extra charges from roaming?

    Ann154 wrote:
    If you are getting charged to use the wifi, then it is possible.  Otherwise no
    Just to elaborate here, Ann154 is referring to access charges for wifi, which is nothing to do with Verizon, so if you are using it in a plane, hotel, an internet cafe etc that charges for Wifi rather than being free .   Verizon does not charge you (or indeed know about!) wifi usage, or any other usage that is not on their cellular network (such as using a foreign SIM for example in global phones)  So these charges, if any, will not show up on the verizon bill app.  Having it in airplane mode prevents all cellular data traffic so you should be fine

  • Question regarding MM and FI integration

    Hi Experts
    I have a question regarding MM and FI integration
    Is the transaction Key in OMJJ is same as OBYC transaction key?
    If yes, then why canu2019t I see transaction Key BSX in Movement type 101?
    Thanks

    No, they are not the same.  The movement type transaction (OMJJ) links the account key and account modifier to a specific movement types.  Transaction code (OBYC) contains the account assignments for all material document postings, whether they are movement type dependent or not.  Account key BSX is not movement type dependent.  Instead, BSX is dependent on the valuation class of the material, so it won't show in OMJJ.
    thanks,

  • **question regarding 3G and wif**.

    I have a question regarding 3G and wifi. I have #G activated as well as wifi, when I go to retrieve mail for example I get a pop up asking me if I want to connect to a wifi network…should I have wifi and 3G activated at the same time, and why am I getting the pop up…
    Thanks

    You can have them on at the same time, but they will not be used at the same time for data. The order of preference for data is WiFi > 3G > EDGE > GPRS. You're getting the pop up, most likely, because you have Settings > Wi-Fi > Ask to Join Networks set to ON. You can set that to OFF, and the iPhone will still join known (i.e. previously used) WiFi networks automatically.

  • Question regarding Dashboard and column prompt

    My question regarding Dashboard and column prompt:
    1) Dashboard prompt usually work with only for columns which are in subject area. In my report I've created some of the columns which are based on other columns. Like I've daysNumber column that is based on two other columns, as it calculates the difference of two dates. When I create dashboard prompt I can't find this column there. I need to make a prompt on this column.
    2)For one of the column I've only two values 1 and 0. When I create prompt for this column, is it possible that in drop down list It shows 'Yes' for 1 and 'No' for 0 and still filter the request??

    Hi Toony,...
    I think there was another way of doing this...
    In the dashboard prompt go to Show option > select SQL Results from dropdown.
    There you need to write your Logical SQL like...
    SELECT CASE WHEN 1=0 THEN PERIODS.YEAR ELSE difference of date functionality END FROM SubjectAreaName
    Here.. Periods.Year is the column which is already exists in repository's presentation layer..
    and difference of date functionality is the code or formula of column which you want to show in drop-down...
    Also write the CASE WHEN 1=0 THEN PERIODS.YEAR ELSE difference of date functionality END code in fx of that prompt.
    I think it helps you in doing this..
    Just check and inform me if it works...
    Thanks & Regards
    Kishore Guggilla
    Edited by: Kishore Guggilla on Oct 31, 2008 9:35 AM

  • Few questions regarding Training and event management

    Dear All,
    Can you please help me with the following queries regarding Training and Event Management:
    1. How to freeze a completed business event so that no changes to its record (like delete/update attendee details or event detail) is possible?
    2. How to get feedback from attendee/faculty with a predefined format with rating (1-4 scale)
    3. How to maintain department and category wise training man/hrs or training man/days?
    Any help will be appreciated.
    Regards,
    Toa

    Hi Toa,
    1. Run report RHHISTO0 via SA38. Once the business event is flagged as "historical" no further changes can be done.
    3. SM30 - T77S0 - Make the following swtiches active:
    SEMIN AINST
    SEMIN APART
    Then when events are followed up, these training data is recorded to employee 2002 infotype. You can report on it via PT90 (for department-based selection use "Further selections")
    Regards,
    Dilek

  • MTS with batch management, serialization and Handling unit

    Hello All,
    I am testing a scenario for MTS with batch management, serialization and Handling unit for discrete manufacturing.
    Everything worked fine till I created the Handling unit for the finished product.
    The production order has a quantity of 3 EA.
    It has three serial numbers 1, 2 and 3. (serial numbers can be displayed from order->Header->serial numbers)
    I created one Handling unit for production order quantity of 3 EA.
    I tried to do a goods receipt for the production order using transaction COWBHUWE.
    I get the following error when I try to post the GR:
    Only 0 serial numbers entered instead of 3
    Message no. IO304
    Diagnosis
    There is a serial number obligation, so the number of serial numbers must equal the number of serial numbers in the material document.
    You can post the operation only if you entered the correct number of serial numbers previously.
    System Response
    Depending on the context in which the error arises, the system continues processing, or the required function cannot be performed.
    Procedure
    You have the following options, for example:
    Check that the serial numbers are entered fully.
    If necessary, display an error log.
    If necessary, contact your system administrator.
    What did I miss?
    How to fix this problem?
    Please help.
    Thanks in advance
    George

    I added the serialization procedure HUSL to the serial number profile and it fixed the problem.

  • [svn:bz-trunk] 22429: Adding the default fallback of serializer and deserializer classes to amf deserializer and amf serializer

    Revision: 22429
    Revision: 22429
    Author:   [email protected]
    Date:     2011-09-07 08:04:46 -0700 (Wed, 07 Sep 2011)
    Log Message:
    Adding the default fallback of serializer and deserializer classes to amf deserializer and amf serializer
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/io/SerializationContext.java

  • I am having a dought regarding import and export.

    I am having a dought regarding import and export.
    I am having one table called login_table where 40k rows are present and in production server. Now i want to take a export dump of login_table and want to import it into a table called table_login which has zero rows but having same table structure and it is present in another database. Please reply soon.

    Please reply soonWhy?
    This is a forum of volunteers, so no one is under any obligation to you. Please stop to be demanding and consequently insulting.
    Also what doubt do you have? It wouldn't work? This begs the question why you just didn't try? No one ever died from working.
    Sybrand Bakker
    Senior Oracle DBA

  • Diff between Serialization and Synchronization

    Hi I am new to java.
    Pl. give me the difference between Serialization and Synchronization.
    Thankq
    Sridhar

    Don't you look at the timestamps of posts? They could
    have been typing at the same time.
    /KajPlease stop! I'll die laughing. LOL
    Re: Diff between Serialization and Synchronization
    Author: Annie.   Apr 11, 2005 10:30 AM (reply 1 of 4)  
    Re: Diff between Serialization and Synchronization
    Author: glrao   Apr 12, 2005 8:31 AM (reply 2 of 4) I really like your sense of humor.
    xH4x0r

  • Diff between Serialization and Synchonization

    Hi I am new to java.
    Pl. give me the difference between Serialization and Synchonization.
    Thankq
    Sridhar

    Pl. give me the difference between Serialization and
    Synchonization.Object serialization is the process of saving an object's state to a sequence of bytes, as well as the process of rebuilding those bytes into a live object at some future time. The Java Serialization API provides a standard mechanism for developers to handle object serialization.
    Synchronization is intended to make the code thread safe by setting locks on objects.
    They are totally different concepts. I fail to understand how you intend to compare them.

Maybe you are looking for

  • Problem about execute import button

    This is mdm 5.5 sp4. First, i did field mapping and value mapping in mdm import manager. Then i clicked 'execute import' button. The importing was successful. After that, I added new fields in ‘destination fields’ of ‘field mapping’ panel via ‘add’ b

  • Resolution issue b/w monitors and Internet

    I've been working on some night photos I took of the northern lights and I've run into an issue.  After doing my usual processing with Photoshop my pictures look the way I'd like them to on my desktop monitor.  I then do my usual Convert to Profile--

  • Incorrect task due dates after synchroniz​ation

    My device: Curve 8900. TMobile. Blackberry desktop manager software v5.0.1. Windows VISTA. Outlook 2003, SP3. Sorry, not sure of the exact mechanics of what happens, but I know that after synchronizing my Curve with Outlook, or perhaps it takes multi

  • Icon View question

    We have an iMac running 9.2.2. I generally create documents and store them in a folder as the smaller size icons, in the order that they were created. I've always arranged them manually: the documents run from the top to bottom of a window (in the or

  • I create a PDF and later I get these little boxes with x's that cover up the words, what is this and how do I make this stop?

    I create a PDF and later these little boxes with X's appear over the letters and numbers and make it difficult to see what is written on the PDF's what can I do to get rid of them?