1 16 17 18 package org.apache.commons.betwixt.strategy; 19 20 import org.apache.commons.betwixt.IntrospectionConfiguration; 21 22 30 public abstract class SimpleTypeMapper { 31 32 40 public static class Binding { 41 public static final Binding ELEMENT = new Binding(1); 42 public static final Binding ATTRIBUTE = new Binding(2); 43 44 private static final int ELEMENT_CODE = 1; 45 private static final int ATTRIBUTE_CODE = 2; 46 47 private int code; 48 private Binding(int code) { 49 this.code = code; 50 } 51 52 53 56 public boolean equals( Object obj ) { 57 boolean result = false; 58 if ( obj == this ) { 59 result = true; 60 } 61 return result; 62 } 63 64 67 public int hashCode() { 68 return code; 69 } 70 71 74 public String toString() { 75 String result = "[Binding]"; 76 switch (code) { 77 case ELEMENT_CODE: 78 result = "[Binding: ELEMENT]"; 79 break; 80 81 case ATTRIBUTE_CODE: 82 result = "[Binding: ATTRIBUTE]"; 83 break; 84 } 85 return result; 86 } 87 } 88 89 99 public abstract SimpleTypeMapper.Binding bind( 100 String propertyName, 101 Class propertyType, 102 IntrospectionConfiguration configuration); 103 } 104 | Popular Tags |