@Test public void testCreateFieldByType() { testCreateFieldByType(byte.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(Byte.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(short.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(Short.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(int.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(Integer.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(long.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(Long.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(BigInteger.class, IntegerListBoxFieldDefinition.class); testCreateFieldByType(float.class, DecimalListBoxFieldDefinition.class); testCreateFieldByType(Float.class, DecimalListBoxFieldDefinition.class); testCreateFieldByType(double.class, DecimalListBoxFieldDefinition.class); testCreateFieldByType(Double.class, DecimalListBoxFieldDefinition.class); testCreateFieldByType(BigDecimal.class, DecimalListBoxFieldDefinition.class); testCreateFieldByType(char.class, CharacterListBoxFieldDefinition.class); testCreateFieldByType(Character.class, CharacterListBoxFieldDefinition.class); testCreateFieldByType(String.class, StringListBoxFieldDefinition.class); when(typeInfo.getType()).thenReturn(TypeKind.ENUM); testCreateFieldByType(Enum.class, EnumListBoxFieldDefinition.class); }
@Override public ListBoxBaseDefinition createFieldByType(TypeInfo typeInfo) { if (typeInfo.getType().equals(TypeKind.ENUM)) { return new EnumListBoxFieldDefinition(); } String className = typeInfo.getClassName(); if (Byte.class.getName().equals(className) || byte.class.getName().equals(className) || Short.class.getName().equals(className) || short.class.getName().equals(className) || Integer.class.getName().equals(className) || int.class.getName().equals(className) || Long.class.getName().equals(className) || long.class.getName().equals(className) || BigInteger.class.getName().equals(className)) { return new IntegerListBoxFieldDefinition(); } if (Float.class.getName().equals(className) || float.class.getName().equals(className) || Double.class.getName().equals(className) || double.class.getName().equals(className) || BigDecimal.class.getName().equals(className)) { return new DecimalListBoxFieldDefinition(); } if (Character.class.getName().equals(className) || char.class.getName().equals(className)) { return new CharacterListBoxFieldDefinition(); } for (String type : getSupportedTypes()) { if (type.equals(typeInfo.getClassName())) { return new StringListBoxFieldDefinition(); } } return new EnumListBoxFieldDefinition(); }
ListBoxFieldProvider extends SelectorFieldProvider<ListBoxBaseDefinition> { @Override public ListBoxBaseDefinition createFieldByType(TypeInfo typeInfo) { if (typeInfo.getType().equals(TypeKind.ENUM)) { return new EnumListBoxFieldDefinition(); } String className = typeInfo.getClassName(); if (Byte.class.getName().equals(className) || byte.class.getName().equals(className) || Short.class.getName().equals(className) || short.class.getName().equals(className) || Integer.class.getName().equals(className) || int.class.getName().equals(className) || Long.class.getName().equals(className) || long.class.getName().equals(className) || BigInteger.class.getName().equals(className)) { return new IntegerListBoxFieldDefinition(); } if (Float.class.getName().equals(className) || float.class.getName().equals(className) || Double.class.getName().equals(className) || double.class.getName().equals(className) || BigDecimal.class.getName().equals(className)) { return new DecimalListBoxFieldDefinition(); } if (Character.class.getName().equals(className) || char.class.getName().equals(className)) { return new CharacterListBoxFieldDefinition(); } for (String type : getSupportedTypes()) { if (type.equals(typeInfo.getClassName())) { return new StringListBoxFieldDefinition(); } } return new EnumListBoxFieldDefinition(); } }
ListBoxFieldProvider extends SelectorFieldProvider<ListBoxBaseDefinition> { @Override public ListBoxBaseDefinition createFieldByType(TypeInfo typeInfo) { if (typeInfo.getType().equals(TypeKind.ENUM)) { return new EnumListBoxFieldDefinition(); } String className = typeInfo.getClassName(); if (Byte.class.getName().equals(className) || byte.class.getName().equals(className) || Short.class.getName().equals(className) || short.class.getName().equals(className) || Integer.class.getName().equals(className) || int.class.getName().equals(className) || Long.class.getName().equals(className) || long.class.getName().equals(className) || BigInteger.class.getName().equals(className)) { return new IntegerListBoxFieldDefinition(); } if (Float.class.getName().equals(className) || float.class.getName().equals(className) || Double.class.getName().equals(className) || double.class.getName().equals(className) || BigDecimal.class.getName().equals(className)) { return new DecimalListBoxFieldDefinition(); } if (Character.class.getName().equals(className) || char.class.getName().equals(className)) { return new CharacterListBoxFieldDefinition(); } for (String type : getSupportedTypes()) { if (type.equals(typeInfo.getClassName())) { return new StringListBoxFieldDefinition(); } } return new EnumListBoxFieldDefinition(); }  }
ListBoxFieldProvider extends SelectorFieldProvider<ListBoxBaseDefinition> { @Override public ListBoxBaseDefinition createFieldByType(TypeInfo typeInfo) { if (typeInfo.getType().equals(TypeKind.ENUM)) { return new EnumListBoxFieldDefinition(); } String className = typeInfo.getClassName(); if (Byte.class.getName().equals(className) || byte.class.getName().equals(className) || Short.class.getName().equals(className) || short.class.getName().equals(className) || Integer.class.getName().equals(className) || int.class.getName().equals(className) || Long.class.getName().equals(className) || long.class.getName().equals(className) || BigInteger.class.getName().equals(className)) { return new IntegerListBoxFieldDefinition(); } if (Float.class.getName().equals(className) || float.class.getName().equals(className) || Double.class.getName().equals(className) || double.class.getName().equals(className) || BigDecimal.class.getName().equals(className)) { return new DecimalListBoxFieldDefinition(); } if (Character.class.getName().equals(className) || char.class.getName().equals(className)) { return new CharacterListBoxFieldDefinition(); } for (String type : getSupportedTypes()) { if (type.equals(typeInfo.getClassName())) { return new StringListBoxFieldDefinition(); } } return new EnumListBoxFieldDefinition(); }  @Override Class<ListBoxFieldType> getFieldType(); @Override String getFieldTypeName(); @Override int getPriority(); @Override ListBoxBaseDefinition getDefaultField(); @Override ListBoxBaseDefinition createFieldByType(TypeInfo typeInfo); @Override boolean supports(Class clazz); @Override boolean isSupported(TypeInfo typeInfo); }
ListBoxFieldProvider extends SelectorFieldProvider<ListBoxBaseDefinition> { @Override public ListBoxBaseDefinition createFieldByType(TypeInfo typeInfo) { if (typeInfo.getType().equals(TypeKind.ENUM)) { return new EnumListBoxFieldDefinition(); } String className = typeInfo.getClassName(); if (Byte.class.getName().equals(className) || byte.class.getName().equals(className) || Short.class.getName().equals(className) || short.class.getName().equals(className) || Integer.class.getName().equals(className) || int.class.getName().equals(className) || Long.class.getName().equals(className) || long.class.getName().equals(className) || BigInteger.class.getName().equals(className)) { return new IntegerListBoxFieldDefinition(); } if (Float.class.getName().equals(className) || float.class.getName().equals(className) || Double.class.getName().equals(className) || double.class.getName().equals(className) || BigDecimal.class.getName().equals(className)) { return new DecimalListBoxFieldDefinition(); } if (Character.class.getName().equals(className) || char.class.getName().equals(className)) { return new CharacterListBoxFieldDefinition(); } for (String type : getSupportedTypes()) { if (type.equals(typeInfo.getClassName())) { return new StringListBoxFieldDefinition(); } } return new EnumListBoxFieldDefinition(); }  @Override Class<ListBoxFieldType> getFieldType(); @Override String getFieldTypeName(); @Override int getPriority(); @Override ListBoxBaseDefinition getDefaultField(); @Override ListBoxBaseDefinition createFieldByType(TypeInfo typeInfo); @Override boolean supports(Class clazz); @Override boolean isSupported(TypeInfo typeInfo);  }