Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » derivation from existing Java classes
derivation from existing Java classes [message #64682] Thu, 20 October 2005 03:52 Go to next message
Enrique is currently offline Enrique
Messages: 44
Registered: July 2009
Member
Hi,
if I understood well, the generated classes are notifiers, but they aren`t
adapters.
I would like them to derive from an adapter class.

As simpleType it could look like this:

<xsd:simpleType ecore:name="AnotherAdapter"
ecore:instanceClass="org.eclipse.emf.common.notify.impl.AdapterImpl ">
<xsd:restriction/>
</xsd:simpleType>

But as it is not possible to derive from a simpleType, that doesn`t work.

The only thing which comes in my mind is to have an adapter as instance in
the specified objects.
Is there another possibility to derive objects from existing Java classes?
Thanks for help in advance.
Re: derivation from existing Java classes [message #64705 is a reply to message #64682] Thu, 20 October 2005 05:42 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------070604030007060606040509
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Enrique,

You can mix in your own interfaces and can add your own methods into the
generated code so I'm not sure you should be trying to model this in the
schema. After all, will you be able to convert your adapter instance to
and from a string representation? This is how you can extend additional
interfaces by hand:

import org.eclipse.emf.common.util.Enumerator;


/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>EEnum Literal</b></em>'.
* @extends Enumerator
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getValue
<em>Value</em>}</li>
* <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getInstance
<em>Instance</em>}</li>
* <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getEEnum
<em>EEnum</em>}</li>
* </ul>
* </p>
*
* @see org.eclipse.emf.ecore.EcorePackage#getEEnumLiteral()
* @model
* @generated
*/
public interface EEnumLiteral extends ENamedElement, Enumerator

As part of 93194 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=93194>
I am looking into extending the annotation syntax so that things like
EOperations and multiple inheritance are expressible directly in the
schema (to try to make Ecore -> XSD -> Ecore a round trip).


Enrique wrote:

> Hi,
> if I understood well, the generated classes are notifiers, but they
> aren`t adapters.
> I would like them to derive from an adapter class.
>
> As simpleType it could look like this:
>
> <xsd:simpleType ecore:name="AnotherAdapter"
> ecore:instanceClass="org.eclipse.emf.common.notify.impl.AdapterImpl ">
> <xsd:restriction/>
> </xsd:simpleType>
>
> But as it is not possible to derive from a simpleType, that doesn`t work.
>
> The only thing which comes in my mind is to have an adapter as
> instance in the specified objects.
> Is there another possibility to derive objects from existing Java
> classes? Thanks for help in advance.
>
>


--------------070604030007060606040509
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Enrique,<br>
<br>
You can mix in your own interfaces and can add your own methods into
the generated code so I'm not sure you should be trying to model this
in the schema.
Re: derivation from existing Java classes [message #64726 is a reply to message #64705] Thu, 20 October 2005 06:31 Go to previous message
Enrique is currently offline Enrique
Messages: 44
Registered: July 2009
Member
OK, that helps me already.
Thanks a lot.

Ed Merks wrote:

> Enrique,

> You can mix in your own interfaces and can add your own methods into the
> generated code so I'm not sure you should be trying to model this in the
> schema. After all, will you be able to convert your adapter instance to
> and from a string representation? This is how you can extend additional
> interfaces by hand:

> import org.eclipse.emf.common.util.Enumerator;


> /**
> * <!-- begin-user-doc -->
> * A representation of the model object '<em><b>EEnum Literal</b></em>'.
> * @extends Enumerator
> * <!-- end-user-doc -->
> *
> * <p>
> * The following features are supported:
> * <ul>
> * <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getValue
> <em>Value</em>}</li>
> * <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getInstance
> <em>Instance</em>}</li>
> * <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getEEnum
> <em>EEnum</em>}</li>
> * </ul>
> * </p>
> *
> * @see org.eclipse.emf.ecore.EcorePackage#getEEnumLiteral()
> * @model
> * @generated
> */
> public interface EEnumLiteral extends ENamedElement, Enumerator

> As part of 93194 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=93194>
> I am looking into extending the annotation syntax so that things like
> EOperations and multiple inheritance are expressible directly in the
> schema (to try to make Ecore -> XSD -> Ecore a round trip).


> Enrique wrote:

>> Hi,
>> if I understood well, the generated classes are notifiers, but they
>> aren`t adapters.
>> I would like them to derive from an adapter class.
>>
>> As simpleType it could look like this:
>>
>> <xsd:simpleType ecore:name="AnotherAdapter"
>> ecore:instanceClass="org.eclipse.emf.common.notify.impl.AdapterImpl ">
>> <xsd:restriction/>
>> </xsd:simpleType>
>>
>> But as it is not possible to derive from a simpleType, that doesn`t work.
>>
>> The only thing which comes in my mind is to have an adapter as
>> instance in the specified objects.
>> Is there another possibility to derive objects from existing Java
>> classes? Thanks for help in advance.
>>
>>
Re: derivation from existing Java classes [message #597037 is a reply to message #64682] Thu, 20 October 2005 05:42 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25943
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070604030007060606040509
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Enrique,

You can mix in your own interfaces and can add your own methods into the
generated code so I'm not sure you should be trying to model this in the
schema. After all, will you be able to convert your adapter instance to
and from a string representation? This is how you can extend additional
interfaces by hand:

import org.eclipse.emf.common.util.Enumerator;


/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>EEnum Literal</b></em>'.
* @extends Enumerator
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getValue
<em>Value</em>}</li>
* <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getInstance
<em>Instance</em>}</li>
* <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getEEnum
<em>EEnum</em>}</li>
* </ul>
* </p>
*
* @see org.eclipse.emf.ecore.EcorePackage#getEEnumLiteral()
* @model
* @generated
*/
public interface EEnumLiteral extends ENamedElement, Enumerator

As part of 93194 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=93194>
I am looking into extending the annotation syntax so that things like
EOperations and multiple inheritance are expressible directly in the
schema (to try to make Ecore -> XSD -> Ecore a round trip).


Enrique wrote:

> Hi,
> if I understood well, the generated classes are notifiers, but they
> aren`t adapters.
> I would like them to derive from an adapter class.
>
> As simpleType it could look like this:
>
> <xsd:simpleType ecore:name="AnotherAdapter"
> ecore:instanceClass="org.eclipse.emf.common.notify.impl.AdapterImpl ">
> <xsd:restriction/>
> </xsd:simpleType>
>
> But as it is not possible to derive from a simpleType, that doesn`t work.
>
> The only thing which comes in my mind is to have an adapter as
> instance in the specified objects.
> Is there another possibility to derive objects from existing Java
> classes? Thanks for help in advance.
>
>


--------------070604030007060606040509
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Enrique,<br>
<br>
You can mix in your own interfaces and can add your own methods into
the generated code so I'm not sure you should be trying to model this
in the schema.
Re: derivation from existing Java classes [message #597049 is a reply to message #64705] Thu, 20 October 2005 06:31 Go to previous message
Enrique is currently offline Enrique
Messages: 44
Registered: July 2009
Member
OK, that helps me already.
Thanks a lot.

Ed Merks wrote:

> Enrique,

> You can mix in your own interfaces and can add your own methods into the
> generated code so I'm not sure you should be trying to model this in the
> schema. After all, will you be able to convert your adapter instance to
> and from a string representation? This is how you can extend additional
> interfaces by hand:

> import org.eclipse.emf.common.util.Enumerator;


> /**
> * <!-- begin-user-doc -->
> * A representation of the model object '<em><b>EEnum Literal</b></em>'.
> * @extends Enumerator
> * <!-- end-user-doc -->
> *
> * <p>
> * The following features are supported:
> * <ul>
> * <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getValue
> <em>Value</em>}</li>
> * <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getInstance
> <em>Instance</em>}</li>
> * <li>{@link org.eclipse.emf.ecore.EEnumLiteral#getEEnum
> <em>EEnum</em>}</li>
> * </ul>
> * </p>
> *
> * @see org.eclipse.emf.ecore.EcorePackage#getEEnumLiteral()
> * @model
> * @generated
> */
> public interface EEnumLiteral extends ENamedElement, Enumerator

> As part of 93194 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=93194>
> I am looking into extending the annotation syntax so that things like
> EOperations and multiple inheritance are expressible directly in the
> schema (to try to make Ecore -> XSD -> Ecore a round trip).


> Enrique wrote:

>> Hi,
>> if I understood well, the generated classes are notifiers, but they
>> aren`t adapters.
>> I would like them to derive from an adapter class.
>>
>> As simpleType it could look like this:
>>
>> <xsd:simpleType ecore:name="AnotherAdapter"
>> ecore:instanceClass="org.eclipse.emf.common.notify.impl.AdapterImpl ">
>> <xsd:restriction/>
>> </xsd:simpleType>
>>
>> But as it is not possible to derive from a simpleType, that doesn`t work.
>>
>> The only thing which comes in my mind is to have an adapter as
>> instance in the specified objects.
>> Is there another possibility to derive objects from existing Java
>> classes? Thanks for help in advance.
>>
>>
Previous Topic:derivation from existing Java classes
Next Topic:"unique" support
Goto Forum:
  


Current Time: Wed Jul 30 09:25:57 EDT 2014

Powered by FUDForum. Page generated in 0.02364 seconds