Examples of FieldNamingStrategy


Examples of com.google.gson.FieldNamingStrategy

      assertEquals(extractor.extractName(SimpleTest.class.getDeclaredField("d").getAnnotation(Named.class)),
            "dog");
   }
  
   public void testAnnotationFieldNamingStrategy() throws Exception {
      FieldNamingStrategy strategy = new AnnotationFieldNamingStrategy(ImmutableSet.of(new ExtractNamed()));

      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("a")), null);
      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("b")), null);
      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("c")), "cat");
      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("d")), "dog");
   }
View Full Code Here

Examples of com.google.gson.FieldNamingStrategy

      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("c")), "cat");
      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("d")), "dog");
   }

   public void testAnnotationOrNameFieldNamingStrategy() throws Exception {
      FieldNamingStrategy strategy = new AnnotationOrNameFieldNamingStrategy(ImmutableSet.of(new ExtractNamed()));

      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("a")), "a");
      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("b")), "b");
      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("c")), "cat");
      assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("d")), "dog");
   }
View Full Code Here

Examples of org.springframework.data.mapping.model.FieldNamingStrategy

  @Test
  public void populatesPersistentPropertyWithCustomFieldNamingStrategy() {

    MongoMappingContext context = new MongoMappingContext();
    context.setApplicationContext(applicationContext);
    context.setFieldNamingStrategy(new FieldNamingStrategy() {

      public String getFieldName(PersistentProperty<?> property) {
        return property.getName().toUpperCase(Locale.US);
      }
    });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.