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:[email protected].  Thank you.



Reply via email to