Package ma.glasnost.orika

Examples of ma.glasnost.orika.DefaultFieldMapper


   
    @Test
    public void testMappingInterfaceImplementationNoExistingMapping() throws Exception {
       
     
        DefaultFieldMapper myHint =
                /**
                 * This sample hint converts "myProperty" to "property", and vis-versa.
                 */
                new DefaultFieldMapper() {
                   
                    public String suggestMappedField(String fromProperty, Type<?> fromPropertyType) {
                        if (fromProperty.startsWith("my")) {
                            return fromProperty.substring(2, 3).toLowerCase() + fromProperty.substring(3);
                        } else {
View Full Code Here


   
    @Test
    public void testMappingSubclassImplementationWithoutExistingMapping() throws Exception {
       
        MapperFactory factory = MappingUtil.getMapperFactory();
        DefaultFieldMapper myHint =
        /**
         * This sample hint converts "myProperty" to "property", and vis-versa.
         */
        new DefaultFieldMapper() {

            public String suggestMappedField(String fromProperty, Type<?> fromPropertyType) {
                if (fromProperty.startsWith("my")) {
                    return fromProperty.substring(2, 1).toLowerCase() + fromProperty.substring(3);
                } else {
View Full Code Here

     */
    @Test
    public void testSuperTypeForInaccessibleClassWithAccessibleSupertype() throws Exception {
       
        MapperFactory factory = MappingUtil.getMapperFactory();
        DefaultFieldMapper myHint =
        /**
         * This sample hint converts "myProperty" to "property", and vis-versa.
         */
        new DefaultFieldMapper() {
           
            public String suggestMappedField(String fromProperty, Type<?> fromPropertyType) {
                if (fromProperty.startsWith("my")) {
                    return fromProperty.substring(2, 3).toLowerCase() + fromProperty.substring(3);
                } else {
View Full Code Here

   
   
    SoftReference<ClassLoader> childLoaderRef = null;
   
    MapperFactory factory = MappingUtil.getMapperFactory();
    DefaultFieldMapper fieldDefault =
      /**
       * This sample hint converts "myProperty" to "property", and vis-versa.
       */
      new DefaultFieldMapper() {

        public String suggestMappedField(String fromProperty, Type<?> fromPropertyType) {
          if (fromProperty.startsWith("my")) {
            return fromProperty.substring(2, 3).toLowerCase() + fromProperty.substring(3);
          } else {
View Full Code Here

    public void testAutomaticCaseWithHint() throws Throwable {
       
        final SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN);
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        factory.registerDefaultFieldMapper(new DefaultFieldMapper() {

          public String suggestMappedField(String fromProperty,
          Type<?> fromPropertyType) {
          if ("dateOfBirth".equals(fromProperty)) {
            return "date";
View Full Code Here

    public void testPrimitivePropertiesWithWrapperConstructor() throws Throwable {
     
      final SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN);
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        factory.registerDefaultFieldMapper(new DefaultFieldMapper() {

          public String suggestMappedField(String fromProperty,
          Type<?> fromPropertyType) {
          if ("dateOfBirth".equals(fromProperty)) {
            return "date";
View Full Code Here

     */
    @Test
    public void testSuperTypeForInaccessibleClassWithAccessibleSupertype() throws Exception {
       
        MapperFactory factory = MappingUtil.getMapperFactory();
        DefaultFieldMapper myHint =
        /**
         * This sample hint converts "myProperty" to "property", and vis-versa.
         */
        new DefaultFieldMapper() {
           
            public String suggestMappedField(String fromProperty, Type<?> fromPropertyType) {
                if (fromProperty.startsWith("my")) {
                    return fromProperty.substring(2, 3).toLowerCase() + fromProperty.substring(3);
                } else {
View Full Code Here

    public void testAutomaticCaseWithHint() throws Throwable {
       
        final SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN);
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        factory.registerDefaultFieldMapper(new DefaultFieldMapper() {

          public String suggestMappedField(String fromProperty,
          Type<?> fromPropertyType) {
          if ("dateOfBirth".equals(fromProperty)) {
            return "date";
View Full Code Here

    public void testPrimitivePropertiesWithWrapperConstructor() throws Throwable {
     
      final SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN);
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        factory.registerDefaultFieldMapper(new DefaultFieldMapper() {

          public String suggestMappedField(String fromProperty,
          Type<?> fromPropertyType) {
          if ("dateOfBirth".equals(fromProperty)) {
            return "date";
View Full Code Here

TOP

Related Classes of ma.glasnost.orika.DefaultFieldMapper

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.