You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Stopp, Bryan" <Br...@argushealth.com> on 2010/06/15 20:46:47 UTC

Override Aegis Default Mapping

Ok, I'm trying to override the default BigDecimalType in the Aegis
mapping; there's a bug, as it uses the toString() method on the
BigDecimal class, which by default prints any values in Scientific
Notation. According to the XSD & XML spec, decimal fields (which
BigDecimal maps to) are not supposed to use any notations other than the
decimal.

 

Basically, 0.0000000 is being printed as 0E-8.

 

I created my own type class:

 

public class BigDecimalOverriedType extends BigDecimalType {

      

      

      @Override

      public void writeObject(Object object, MessageWriter writer,
Context context) {

          

            writer.writeValue(((BigDecimal) object).toPlainString());

      }

}

 

 

But, when I registered it:

 

      @PostConstruct

      public void init() {

        TypeMapping typeMapping =
aegisDatabinding.getAegisContext().getTypeMapping(); 

//          Type oldType = typeMapping.getType(BigDecimal.class);

//        typeMapping.removeType(oldType);

        typeMapping.register(BigDecimal.class,
XMLSchemaQNames.XSD_DECIMAL, new BigDecimalOverriedType());

      }

 

The BigDecimalType is still being used of a lot of BigDecimal instances.
I want my type to be used for all of them. 

 

Yes, I have read the source, and that's why I thought this would work,
but it's intermittent. Does anyone have any idea how to fix this issue
until I submit a bug/patch for the underlying problem?

 

Thanks.

 

-B 




PRIVILEGED AND CONFIDENTIAL
This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above.  If the reader of the email is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any use, dissemination or copying of this email transmission is strictly prohibited by the sender.  If you have received this transmission in error, please delete the email and immediately notify the sender via the email return address or mailto:postmaster@argushealth.com.  Thank you.




RE: Override Aegis Default Mapping

Posted by "Stopp, Bryan" <Br...@argushealth.com>.
Done and done. With a patch. 

https://issues.apache.org/jira/browse/CXF-2847

-Bryan Stopp 
Software Engineer 
Web Application Development 
Extension: 51753 
Commercial: 816-435-1753 

-----Original Message-----
From: Benson Margulies [mailto:bimargulies@gmail.com] 
Sent: Tuesday, June 15, 2010 4:30 PM
To: users@cxf.apache.org
Subject: Re: Override Aegis Default Mapping

A JIRA with a test case, please?

On Tue, Jun 15, 2010 at 2:46 PM, Stopp, Bryan
<Br...@argushealth.com> wrote:
> Ok, I'm trying to override the default BigDecimalType in the Aegis
> mapping; there's a bug, as it uses the toString() method on the
> BigDecimal class, which by default prints any values in Scientific
> Notation. According to the XSD & XML spec, decimal fields (which
> BigDecimal maps to) are not supposed to use any notations other than the
> decimal.
>
>
>
> Basically, 0.0000000 is being printed as 0E-8.
>
>
>
> I created my own type class:
>
>
>
> public class BigDecimalOverriedType extends BigDecimalType {
>
>
>
>
>
>      @Override
>
>      public void writeObject(Object object, MessageWriter writer,
> Context context) {
>
>
>
>            writer.writeValue(((BigDecimal) object).toPlainString());
>
>      }
>
> }
>
>
>
>
>
> But, when I registered it:
>
>
>
>      @PostConstruct
>
>      public void init() {
>
>        TypeMapping typeMapping =
> aegisDatabinding.getAegisContext().getTypeMapping();
>
> //          Type oldType = typeMapping.getType(BigDecimal.class);
>
> //        typeMapping.removeType(oldType);
>
>        typeMapping.register(BigDecimal.class,
> XMLSchemaQNames.XSD_DECIMAL, new BigDecimalOverriedType());
>
>      }
>
>
>
> The BigDecimalType is still being used of a lot of BigDecimal instances.
> I want my type to be used for all of them.
>
>
>
> Yes, I have read the source, and that's why I thought this would work,
> but it's intermittent. Does anyone have any idea how to fix this issue
> until I submit a bug/patch for the underlying problem?
>
>
>
> Thanks.
>
>
>
> -B
>
>
>
>
> PRIVILEGED AND CONFIDENTIAL
> This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above.  If the reader of the email is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any use, dissemination or copying of this email transmission is strictly prohibited by the sender.  If you have received this transmission in error, please delete the email and immediately notify the sender via the email return address or mailto:postmaster@argushealth.com.  Thank you.
>
>
>
>


PRIVILEGED AND CONFIDENTIAL
This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above.  If the reader of the email is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any use, dissemination or copying of this email transmission is strictly prohibited by the sender.  If you have received this transmission in error, please delete the email and immediately notify the sender via the email return address or mailto:postmaster@argushealth.com.  Thank you.




Re: Override Aegis Default Mapping

Posted by Benson Margulies <bi...@gmail.com>.
A JIRA with a test case, please?

On Tue, Jun 15, 2010 at 2:46 PM, Stopp, Bryan
<Br...@argushealth.com> wrote:
> Ok, I'm trying to override the default BigDecimalType in the Aegis
> mapping; there's a bug, as it uses the toString() method on the
> BigDecimal class, which by default prints any values in Scientific
> Notation. According to the XSD & XML spec, decimal fields (which
> BigDecimal maps to) are not supposed to use any notations other than the
> decimal.
>
>
>
> Basically, 0.0000000 is being printed as 0E-8.
>
>
>
> I created my own type class:
>
>
>
> public class BigDecimalOverriedType extends BigDecimalType {
>
>
>
>
>
>      @Override
>
>      public void writeObject(Object object, MessageWriter writer,
> Context context) {
>
>
>
>            writer.writeValue(((BigDecimal) object).toPlainString());
>
>      }
>
> }
>
>
>
>
>
> But, when I registered it:
>
>
>
>      @PostConstruct
>
>      public void init() {
>
>        TypeMapping typeMapping =
> aegisDatabinding.getAegisContext().getTypeMapping();
>
> //          Type oldType = typeMapping.getType(BigDecimal.class);
>
> //        typeMapping.removeType(oldType);
>
>        typeMapping.register(BigDecimal.class,
> XMLSchemaQNames.XSD_DECIMAL, new BigDecimalOverriedType());
>
>      }
>
>
>
> The BigDecimalType is still being used of a lot of BigDecimal instances.
> I want my type to be used for all of them.
>
>
>
> Yes, I have read the source, and that's why I thought this would work,
> but it's intermittent. Does anyone have any idea how to fix this issue
> until I submit a bug/patch for the underlying problem?
>
>
>
> Thanks.
>
>
>
> -B
>
>
>
>
> PRIVILEGED AND CONFIDENTIAL
> This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above.  If the reader of the email is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any use, dissemination or copying of this email transmission is strictly prohibited by the sender.  If you have received this transmission in error, please delete the email and immediately notify the sender via the email return address or mailto:postmaster@argushealth.com.  Thank you.
>
>
>
>