You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jason Berk <jb...@purdueefcu.com> on 2009/09/18 17:18:44 UTC

implementing a custom interface

I have three types in my XSD: Savings, Checking, Certificate.

Is it possible to add something (to the .xsdconfig?) that makes all
three types implement an interface I created?

I want my beans to be like this:

Product
	getStaringBal()
	getEndingBal()

Savings implements Product
	getSavingsSpecificStuff()

Checking implements Product
	getCheckingSpecificStuff()

make sense?

Jason
Now serving Boiler Spirit with every purchase. Switch to the new Purdue debit card today. Show your pride and earn Scorecard Rewards on the side. Just sign for your purchases and score valuable rewards points you can use for travel, electronics or even cash. 



***This is a transmission from Purdue Employees Federal Credit
Union (PEFCU) and is intended solely for its authorized
recipient(s), and may contain information that is confidential
and or legally privileged.  If you are not an addressee, or the
employee or agent responsible for delivering it to an addressee,
you are hereby notified that any use, dissemination,
distribution, publication or copying of the information 
contained
in this email is strictly prohibited. If you have received this
transmission in error, please notify us by telephoning (765)
497-3328 or returning the email. You are then instructed to
delete the information from your computer.  Thank you for your
cooperation.***


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


RE: implementing a custom interface

Posted by Jason Berk <jb...@purdueefcu.com>.
I'm confused.  Like I said, I can't change the way the XML looks when it
comes from the external system.  So I can't use attributes....only
elements because that's how it comes to me.

 

my problem is this:

 

<foo>

            <a>

            <b>

            <X>

            <c>

</foo>

 

<bar>

            <a>

            <b>

            <Y>
            <c>

</bar

 

How do I factor <a> <b> and <c> into a "base" type and extend that base
type in <foo> and <bar>.  Realize <X> and <Y> are in the middle and I
can't change that.

 

Jason

 

________________________________

From: Gillen, Paul [mailto:paul.gillen@nscorp.com] 
Sent: Friday, September 18, 2009 2:34 PM
To: 'user@xmlbeans.apache.org'
Subject: RE: implementing a custom interface

 

My colleagues say this wasn't clear.

 

The base type defined in the XSD in effect becomes the interface to the
implementing types.  This approach keeps you painting between the lines
in the XSD world rather than drifting off the beam customizing XMLBeans.


 

The example below implements a complexType ProductType that has the two
attributes you want in your interface, beginning and ending balance.
The 3 complexTypes SavingsType, CheckingType, and CertificateType extend
ProductType in the XSD and therefore implement the interface in the
code.  Note in the code example that the common information is available
either from the base type (ProductType) or the implementing type.

 

Paul Gillen

 

----------

XSD

----------

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns="xsd.account.bank.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="xsd.account.bank.com" elementFormDefault="qualified"
attributeFormDefault="unqualified">

      <xs:element name="BankExample">

            <xs:complexType>

                  <xs:sequence>

                        <xs:element name="Accounts">

                              <xs:complexType>

                                    <xs:choice maxOccurs="unbounded">

                                          <xs:element name="Savings"
type="SavingsType"/>

                                          <xs:element name="Checking"
type="CheckingType"/>

                                          <xs:element name="Certificate"
type="CertificateType"/>

                                    </xs:choice>

                              </xs:complexType>

                        </xs:element>

                  </xs:sequence>

            </xs:complexType>

      </xs:element>

      <xs:complexType name="ProductType">

            <xs:attribute name="startingBal" type="xs:float"
use="required"/>

            <xs:attribute name="endingBal" type="xs:float"
use="required"/>

      </xs:complexType>

      <xs:complexType name="SavingsType">

            <xs:complexContent>

                  <xs:extension base="ProductType">

                        <xs:attribute name="savingsStuff"
type="xs:string" use="required"/>

                  </xs:extension>

            </xs:complexContent>

      </xs:complexType>

      <xs:complexType name="CheckingType">

            <xs:complexContent>

                  <xs:extension base="ProductType">

                        <xs:attribute name="checkingStuff"
type="xs:string" use="required"/>

                  </xs:extension>

            </xs:complexContent>

      </xs:complexType>

      <xs:complexType name="CertificateType">

            <xs:complexContent>

                  <xs:extension base="ProductType">

                        <xs:attribute name="certificateStuff"
type="xs:string" use="required"/>

                  </xs:extension>

            </xs:complexContent>

      </xs:complexType>

</xs:schema>

----------

CODE

----------

package com.bank.account;

 

import java.io.File;

 

import org.apache.xmlbeans.QNameSet;

import org.apache.xmlbeans.XmlObject;

 

import com.bank.account.xsd.BankExampleDocument;

import com.bank.account.xsd.CertificateType;

import com.bank.account.xsd.CheckingType;

import com.bank.account.xsd.ProductType;

import com.bank.account.xsd.SavingsType;

import com.bank.account.xsd.BankExampleDocument.BankExample.Accounts;

import com.bank.account.xsd.BankExampleDocument.BankExample;

 

 

public class AccountProcessor

{

    private final static    String      xmlFileName     = "Account.xml";

    

    public static void main(String[] args)

    throws Exception

    {

        AccountProcessor module = new AccountProcessor();

        module.go(args);

    }

    

    private void go(String[] args)

    throws Exception

    {

        BankExampleDocument doc                 =
BankExampleDocument.Factory.parse(new File(xmlFileName));

        String              rootURI             =
doc.schemaType().getDocumentElementName().getNamespaceURI();

        BankExample         bankExample         = doc.getBankExample();

        Accounts            accounts            =
bankExample.getAccounts();        

        XmlObject[]         accountsChildren    =
accounts.selectChildren(QNameSet.forWildcardNamespaceString("##any",
rootURI));

        

        if (accountsChildren != null)

        {

            for (XmlObject accountChild:accountsChildren)

            {

                ProductType product     = (ProductType) accountChild;

                System.out.println("Info from ProductType:
"+product.getStartingBal() +" "+product.getEndingBal());

                

                if (accountChild instanceof SavingsType)

                {

                    SavingsType     account     = (SavingsType)
accountChild;

                    System.out.println("Savings
Type:\t\t"+account.getSavingsStuff());

                    System.out.println("Starting
Balance:\t"+account.getStartingBal());

                    System.out.println("Ending
Balance:\t\t"+account.getEndingBal());

                }

                else if (accountChild instanceof CheckingType)

                {

                    CheckingType    account     = (CheckingType)
accountChild;

                    System.out.println("Checking
Type:\t\t"+account.getCheckingStuff());  

                    System.out.println("Starting
Balance:\t"+account.getStartingBal());

                    System.out.println("Ending
Balance:\t\t"+account.getEndingBal());                  

                }

                else if (accountChild instanceof CertificateType)

                {

                    CertificateType account     = (CertificateType)
accountChild;

                    System.out.println("Certificate
Type:\t"+account.getCertificateStuff());

                    System.out.println("Starting
Balance:\t"+account.getStartingBal());

                    System.out.println("Ending
Balance:\t\t"+account.getEndingBal());                    

                }

            }

        }

    }

}

----------

SAMPLE XML

----------

<?xml version="1.0" encoding="UTF-8"?>

<BankExample xmlns="xsd.account.bank.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="xsd.account.bank.com xsd\BankExample.xsd">

      <Accounts>

            <Savings savingsStuff="Savings Info" endingBal="3.14"
startingBal="13.14"/>

            <Checking checkingStuff="Checking Info" endingBal="23.14"
startingBal="33.14"/>

            <Certificate certificateStuff="Certificate Info"
endingBal="43.14" startingBal="53.14"/>

      </Accounts>

</BankExample>

 

----------

OUTPUT

----------

Info from ProductType: 13.14 3.14

Savings Type:           Savings Info

Starting Balance: 13.14

Ending Balance:         3.14

Info from ProductType: 33.14 23.14

Checking Type:          Checking Info

Starting Balance: 33.14

Ending Balance:         23.14

Info from ProductType: 53.14 43.14

Certificate Type: Certificate Info

Starting Balance: 53.14

Ending Balance:         43.14

 

 

-----Original Message-----
From: Gillen, Paul [mailto:paul.gillen@nscorp.com] 
Sent: Friday, September 18, 2009 11:36 AM
To: 'user@xmlbeans.apache.org'
Subject: RE: implementing a custom interface

 

If I understand you correctly, in your XSD create a base type with the
common attributes.  Create types for each of your 3 derived from the
base type.  In your code you can refer to each as basetype and for
specifics test with instanceof.

 

Paul Gillen

 

-----Original Message-----

From: Jason Berk [mailto:jberk@purdueefcu.com] 

Sent: Friday, September 18, 2009 11:19 AM

To: user@xmlbeans.apache.org

Subject: implementing a custom interface

 

I have three types in my XSD: Savings, Checking, Certificate.

 

Is it possible to add something (to the .xsdconfig?) that makes all

three types implement an interface I created?

 

I want my beans to be like this:

 

Product

      getStaringBal()

      getEndingBal()

 

Savings implements Product

      getSavingsSpecificStuff()

 

Checking implements Product

      getCheckingSpecificStuff()

 

make sense?

 

Jason

Now serving Boiler Spirit with every purchase. Switch to the new Purdue
debit card today. Show your pride and earn Scorecard Rewards on the
side. Just sign for your purchases and score valuable rewards points you
can use for travel, electronics or even cash. 

 

 

 

***This is a transmission from Purdue Employees Federal Credit

Union (PEFCU) and is intended solely for its authorized

recipient(s), and may contain information that is confidential

and or legally privileged.  If you are not an addressee, or the

employee or agent responsible for delivering it to an addressee,

you are hereby notified that any use, dissemination,

distribution, publication or copying of the information 

contained

in this email is strictly prohibited. If you have received this

transmission in error, please notify us by telephoning (765)

497-3328 or returning the email. You are then instructed to

delete the information from your computer.  Thank you for your

cooperation.***

 

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org

For additional commands, e-mail: user-help@xmlbeans.apache.org

 

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org

For additional commands, e-mail: user-help@xmlbeans.apache.org

 

 


Now serving Boiler Spirit with every purchase. Switch to the new Purdue debit card today. Show your pride and earn Scorecard Rewards on the side. Just sign for your purchases and score valuable rewards points you can use for travel, electronics or even cash. 



***This is a transmission from Purdue Employees Federal Credit
Union (PEFCU) and is intended solely for its authorized
recipient(s), and may contain information that is confidential
and or legally privileged.  If you are not an addressee, or the
employee or agent responsible for delivering it to an addressee,
you are hereby notified that any use, dissemination,
distribution, publication or copying of the information 
contained
in this email is strictly prohibited. If you have received this
transmission in error, please notify us by telephoning (765)
497-3328 or returning the email. You are then instructed to
delete the information from your computer.  Thank you for your
cooperation.***


RE: implementing a custom interface

Posted by "Gillen, Paul" <pa...@nscorp.com>.
My colleagues say this wasn't clear.



The base type defined in the XSD in effect becomes the interface to the implementing types.  This approach keeps you painting between the lines in the XSD world rather than drifting off the beam customizing XMLBeans.



The example below implements a complexType ProductType that has the two attributes you want in your interface, beginning and ending balance.  The 3 complexTypes SavingsType, CheckingType, and CertificateType extend ProductType in the XSD and therefore implement the interface in the code.  Note in the code example that the common information is available either from the base type (ProductType) or the implementing type.



Paul Gillen


----------

XSD
----------

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns="xsd.account.bank.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="xsd.account.bank.com" elementFormDefault="qualified" attributeFormDefault="unqualified">

      <xs:element name="BankExample">

            <xs:complexType>

                  <xs:sequence>

                        <xs:element name="Accounts">

                              <xs:complexType>

                                    <xs:choice maxOccurs="unbounded">

                                          <xs:element name="Savings" type="SavingsType"/>

                                          <xs:element name="Checking" type="CheckingType"/>

                                          <xs:element name="Certificate" type="CertificateType"/>

                                    </xs:choice>

                              </xs:complexType>

                        </xs:element>

                  </xs:sequence>

            </xs:complexType>

      </xs:element>

      <xs:complexType name="ProductType">

            <xs:attribute name="startingBal" type="xs:float" use="required"/>

            <xs:attribute name="endingBal" type="xs:float" use="required"/>

      </xs:complexType>

      <xs:complexType name="SavingsType">

            <xs:complexContent>

                  <xs:extension base="ProductType">

                        <xs:attribute name="savingsStuff" type="xs:string" use="required"/>

                  </xs:extension>

            </xs:complexContent>

      </xs:complexType>

      <xs:complexType name="CheckingType">

            <xs:complexContent>

                  <xs:extension base="ProductType">

                        <xs:attribute name="checkingStuff" type="xs:string" use="required"/>

                  </xs:extension>

            </xs:complexContent>

      </xs:complexType>

      <xs:complexType name="CertificateType">

            <xs:complexContent>

                  <xs:extension base="ProductType">

                        <xs:attribute name="certificateStuff" type="xs:string" use="required"/>

                  </xs:extension>

            </xs:complexContent>

      </xs:complexType>

</xs:schema>
----------

CODE
----------

package com.bank.account;



import java.io.File;



import org.apache.xmlbeans.QNameSet;

import org.apache.xmlbeans.XmlObject;



import com.bank.account.xsd.BankExampleDocument;

import com.bank.account.xsd.CertificateType;

import com.bank.account.xsd.CheckingType;

import com.bank.account.xsd.ProductType;

import com.bank.account.xsd.SavingsType;

import com.bank.account.xsd.BankExampleDocument.BankExample.Accounts;

import com.bank.account.xsd.BankExampleDocument.BankExample;





public class AccountProcessor

{

    private final static    String      xmlFileName     = "Account.xml";



    public static void main(String[] args)

    throws Exception

    {

        AccountProcessor module = new AccountProcessor();

        module.go(args);

    }



    private void go(String[] args)

    throws Exception

    {

        BankExampleDocument doc                 = BankExampleDocument.Factory.parse(new File(xmlFileName));

        String              rootURI             = doc.schemaType().getDocumentElementName().getNamespaceURI();

        BankExample         bankExample         = doc.getBankExample();

        Accounts            accounts            = bankExample.getAccounts();

        XmlObject[]         accountsChildren    = accounts.selectChildren(QNameSet.forWildcardNamespaceString("##any", rootURI));



        if (accountsChildren != null)

        {

            for (XmlObject accountChild:accountsChildren)

            {

                ProductType product     = (ProductType) accountChild;

                System.out.println("Info from ProductType: "+product.getStartingBal() +" "+product.getEndingBal());



                if (accountChild instanceof SavingsType)

                {

                    SavingsType     account     = (SavingsType) accountChild;

                    System.out.println("Savings Type:\t\t"+account.getSavingsStuff());

                    System.out.println("Starting Balance:\t"+account.getStartingBal());

                    System.out.println("Ending Balance:\t\t"+account.getEndingBal());

                }

                else if (accountChild instanceof CheckingType)

                {

                    CheckingType    account     = (CheckingType) accountChild;

                    System.out.println("Checking Type:\t\t"+account.getCheckingStuff());

                    System.out.println("Starting Balance:\t"+account.getStartingBal());

                    System.out.println("Ending Balance:\t\t"+account.getEndingBal());

                }

                else if (accountChild instanceof CertificateType)

                {

                    CertificateType account     = (CertificateType) accountChild;

                    System.out.println("Certificate Type:\t"+account.getCertificateStuff());

                    System.out.println("Starting Balance:\t"+account.getStartingBal());

                    System.out.println("Ending Balance:\t\t"+account.getEndingBal());

                }

            }

        }

    }

}
----------

SAMPLE XML
----------

<?xml version="1.0" encoding="UTF-8"?>

<BankExample xmlns="xsd.account.bank.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="xsd.account.bank.com xsd\BankExample.xsd">

      <Accounts>

            <Savings savingsStuff="Savings Info" endingBal="3.14" startingBal="13.14"/>

            <Checking checkingStuff="Checking Info" endingBal="23.14" startingBal="33.14"/>

            <Certificate certificateStuff="Certificate Info" endingBal="43.14" startingBal="53.14"/>

      </Accounts>

</BankExample>


----------

OUTPUT
----------
Info from ProductType: 13.14 3.14
Savings Type:           Savings Info
Starting Balance: 13.14
Ending Balance:         3.14
Info from ProductType: 33.14 23.14
Checking Type:          Checking Info
Starting Balance: 33.14
Ending Balance:         23.14
Info from ProductType: 53.14 43.14
Certificate Type: Certificate Info
Starting Balance: 53.14

Ending Balance:         43.14





-----Original Message-----
From: Gillen, Paul [mailto:paul.gillen@nscorp.com]
Sent: Friday, September 18, 2009 11:36 AM
To: 'user@xmlbeans.apache.org'
Subject: RE: implementing a custom interface



If I understand you correctly, in your XSD create a base type with the common attributes.  Create types for each of your 3 derived from the base type.  In your code you can refer to each as basetype and for specifics test with instanceof.



Paul Gillen



-----Original Message-----

From: Jason Berk [mailto:jberk@purdueefcu.com]

Sent: Friday, September 18, 2009 11:19 AM

To: user@xmlbeans.apache.org

Subject: implementing a custom interface



I have three types in my XSD: Savings, Checking, Certificate.



Is it possible to add something (to the .xsdconfig?) that makes all

three types implement an interface I created?



I want my beans to be like this:



Product

      getStaringBal()

      getEndingBal()



Savings implements Product

      getSavingsSpecificStuff()



Checking implements Product

      getCheckingSpecificStuff()



make sense?



Jason

Now serving Boiler Spirit with every purchase. Switch to the new Purdue debit card today. Show your pride and earn Scorecard Rewards on the side. Just sign for your purchases and score valuable rewards points you can use for travel, electronics or even cash.







***This is a transmission from Purdue Employees Federal Credit

Union (PEFCU) and is intended solely for its authorized

recipient(s), and may contain information that is confidential

and or legally privileged.  If you are not an addressee, or the

employee or agent responsible for delivering it to an addressee,

you are hereby notified that any use, dissemination,

distribution, publication or copying of the information

contained

in this email is strictly prohibited. If you have received this

transmission in error, please notify us by telephoning (765)

497-3328 or returning the email. You are then instructed to

delete the information from your computer.  Thank you for your

cooperation.***







---------------------------------------------------------------------

To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org

For additional commands, e-mail: user-help@xmlbeans.apache.org







---------------------------------------------------------------------

To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org

For additional commands, e-mail: user-help@xmlbeans.apache.org





RE: implementing a custom interface

Posted by Jason Berk <jb...@purdueefcu.com>.
Paul,

Thanks for the reply... I'm not very handy with XML (which is why I'm
trying to use xbeans :-)) so I'm not exactly sure if I can do what you
are recommending given my system constraints.  We have product that we
can't really modify that produces XML.  I want to bind to that xml with
xbeans.

I wrote the xsd, here's a piece of it:

<!-- begin share type definitions -->
<xs:complexType name="savingShareType">
	<xs:sequence>
	<xs:element name="suffix" type="xs:token" />
	<xs:element name="description" type="xs:token" />
	<xs:element name="beginningBalance" type="xs:decimal" />
	<xs:element name="endingBalance" type="xs:decimal" />
	<xs:element name="apyEarned" type="xs:float" minOccurs="0" />
	<xs:element name="overdraftFees" type="xs:decimal" minOccurs="0"
/>
	<xs:element name="returnedFees" type="xs:decimal" minOccurs="0"
/>
	<xs:element name="shareTransaction"
type="stmt:shareTransactionType"
		minOccurs="0" maxOccurs="unbounded" />
	<xs:element name="ytdDividends" type="xs:decimal" />
	</xs:sequence>
</xs:complexType>

<xs:complexType name="draftShareType">
	<xs:sequence>
	<xs:element name="suffix" type="xs:token" />
	<xs:element name="description" type="xs:token" />
	<xs:element name="beginningBalance" type="xs:decimal" />
	<xs:element name="endingBalance" type="xs:decimal" />
	<xs:element name="apyEarned" type="xs:float" minOccurs="0" />
	<xs:element name="overdraftFees" type="xs:decimal" minOccurs="0"
/>
	<xs:element name="returnedFees" type="xs:decimal" minOccurs="0"
/>
	<xs:element name="serviceCharges" type="xs:decimal"
minOccurs="0" />
	<xs:element name="numChecksPaid" type="xs:nonNegativeInteger"
minOccurs="0" />
	<xs:element name="shareTransaction"
type="stmt:shareTransactionType"
		minOccurs="0" maxOccurs="unbounded" />
	<xs:element name="ytdDividends" type="xs:decimal" />
	</xs:sequence>
</xs:complexType>

<xs:complexType name="certificateShareType">
	<xs:sequence>
	<xs:element name="suffix" type="xs:token" />
	<xs:element name="description" type="xs:token" />
	<xs:element name="beginningBalance" type="xs:decimal" />
	<xs:element name="endingBalance" type="xs:decimal" />
	<xs:element name="apyEarned" type="xs:float" minOccurs="0" />
	<xs:element name="issueDate" type="xs:date" minOccurs="0" />
	<xs:element name="maturityDate" type="xs:date" minOccurs="0" />
	<xs:element name="certRate" type="xs:float" minOccurs="0" />
	<xs:element name="shareTransaction"
type="stmt:shareTransactionType"
		minOccurs="0" maxOccurs="unbounded" />
	<xs:element name="ytdDividends" type="xs:decimal" />
	</xs:sequence>
</xs:complexType>

Notice they all begin and end with the same fields, and it's the content
in the middle that changes.  I can't modify the program that produces
the XML so I can't "move" the transactions and dividends elements.

In my java code, I want to get a SavingShare, DraftShare and
CertificateShare...all of which extend Share.

How can I have all three types extend a base type that holds the common
content while still allowing for the unbounded transaction type?

My other option is to run the xml through something that reorganizes the
content before using xbeans...which seems silly.

Jason



-----Original Message-----
From: Gillen, Paul [mailto:paul.gillen@nscorp.com] 
Sent: Friday, September 18, 2009 11:36 AM
To: 'user@xmlbeans.apache.org'
Subject: RE: implementing a custom interface

If I understand you correctly, in your XSD create a base type with the
common attributes.  Create types for each of your 3 derived from the
base type.  In your code you can refer to each as basetype and for
specifics test with instanceof.

Paul Gillen
 
-----Original Message-----
From: Jason Berk [mailto:jberk@purdueefcu.com] 
Sent: Friday, September 18, 2009 11:19 AM
To: user@xmlbeans.apache.org
Subject: implementing a custom interface

I have three types in my XSD: Savings, Checking, Certificate.

Is it possible to add something (to the .xsdconfig?) that makes all
three types implement an interface I created?

I want my beans to be like this:

Product
	getStaringBal()
	getEndingBal()

Savings implements Product
	getSavingsSpecificStuff()

Checking implements Product
	getCheckingSpecificStuff()

make sense?

Jason
Now serving Boiler Spirit with every purchase. Switch to the new Purdue
debit card today. Show your pride and earn Scorecard Rewards on the
side. Just sign for your purchases and score valuable rewards points you
can use for travel, electronics or even cash. 



***This is a transmission from Purdue Employees Federal Credit
Union (PEFCU) and is intended solely for its authorized
recipient(s), and may contain information that is confidential
and or legally privileged.  If you are not an addressee, or the
employee or agent responsible for delivering it to an addressee,
you are hereby notified that any use, dissemination,
distribution, publication or copying of the information 
contained
in this email is strictly prohibited. If you have received this
transmission in error, please notify us by telephoning (765)
497-3328 or returning the email. You are then instructed to
delete the information from your computer.  Thank you for your
cooperation.***



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org

Now serving Boiler Spirit with every purchase. Switch to the new Purdue debit card today. Show your pride and earn Scorecard Rewards on the side. Just sign for your purchases and score valuable rewards points you can use for travel, electronics or even cash. 



***This is a transmission from Purdue Employees Federal Credit
Union (PEFCU) and is intended solely for its authorized
recipient(s), and may contain information that is confidential
and or legally privileged.  If you are not an addressee, or the
employee or agent responsible for delivering it to an addressee,
you are hereby notified that any use, dissemination,
distribution, publication or copying of the information 
contained
in this email is strictly prohibited. If you have received this
transmission in error, please notify us by telephoning (765)
497-3328 or returning the email. You are then instructed to
delete the information from your computer.  Thank you for your
cooperation.***


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


RE: implementing a custom interface

Posted by "Gillen, Paul" <pa...@nscorp.com>.
If I understand you correctly, in your XSD create a base type with the common attributes.  Create types for each of your 3 derived from the base type.  In your code you can refer to each as basetype and for specifics test with instanceof.

Paul Gillen
 
-----Original Message-----
From: Jason Berk [mailto:jberk@purdueefcu.com] 
Sent: Friday, September 18, 2009 11:19 AM
To: user@xmlbeans.apache.org
Subject: implementing a custom interface

I have three types in my XSD: Savings, Checking, Certificate.

Is it possible to add something (to the .xsdconfig?) that makes all
three types implement an interface I created?

I want my beans to be like this:

Product
	getStaringBal()
	getEndingBal()

Savings implements Product
	getSavingsSpecificStuff()

Checking implements Product
	getCheckingSpecificStuff()

make sense?

Jason
Now serving Boiler Spirit with every purchase. Switch to the new Purdue debit card today. Show your pride and earn Scorecard Rewards on the side. Just sign for your purchases and score valuable rewards points you can use for travel, electronics or even cash. 



***This is a transmission from Purdue Employees Federal Credit
Union (PEFCU) and is intended solely for its authorized
recipient(s), and may contain information that is confidential
and or legally privileged.  If you are not an addressee, or the
employee or agent responsible for delivering it to an addressee,
you are hereby notified that any use, dissemination,
distribution, publication or copying of the information 
contained
in this email is strictly prohibited. If you have received this
transmission in error, please notify us by telephoning (765)
497-3328 or returning the email. You are then instructed to
delete the information from your computer.  Thank you for your
cooperation.***



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org