Package com.avaje.ebeaninternal.server.type.ScalarTypeEnumStandard

Examples of com.avaje.ebeaninternal.server.type.ScalarTypeEnumStandard.OrdinalEnum


  @Test
  public void test() {
   
     StringEnum stringEnum = new ScalarTypeEnumStandard.StringEnum(Order.Status.class);
    
     OrdinalEnum ordinalEnum = new ScalarTypeEnumStandard.OrdinalEnum(Order.Status.class);
    
     EnumToDbValueMap<?> beanDbMap = EnumToDbValueMap.create(false);
     beanDbMap.add(Customer.Status.ACTIVE, "A");
     beanDbMap.add(Customer.Status.NEW, "N");
     beanDbMap.add(Customer.Status.INACTIVE, "I");
    
     ScalarTypeEnumWithMapping withMapping = new ScalarTypeEnumWithMapping(beanDbMap, Customer.Status.class, 1);
    
    
     Object approved = stringEnum.toBeanType(Order.Status.APPROVED);
     Assert.assertTrue(approved == Order.Status.APPROVED);

     approved = ordinalEnum.toBeanType(Order.Status.APPROVED);
     Assert.assertTrue(approved == Order.Status.APPROVED);

     Object active = withMapping.toBeanType(Customer.Status.ACTIVE);
     Assert.assertTrue(active == Customer.Status.ACTIVE);
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.server.type.ScalarTypeEnumStandard.OrdinalEnum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.