Java Code Examples for org.springframework.beans.propertyeditors.UUIDEditor

Following code examples demonstrate how to use org.springframework.beans.propertyeditors.UUIDEditorfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.beans.propertyeditors.UUIDEditorand various code implementation of this class.

	public void createDefaultEditors() {
		this.defaultEditors = new HashMap<Class<?>, PropertyEditor>(64);

		this.defaultEditors.put(Charset.class, new CharsetEditor());
		this.defaultEditors.put(Class.class, new ClassEditor());
		this.defaultEditors.put(Class[].class, new ClassArrayEditor());
		this.defaultEditors.put(Currency.class, new CurrencyEditor());
		this.defaultEditors.put(File.class, new FileEditor());
		this.defaultEditors.put(InputStream.class, new InputStreamEditor());
		this.defaultEditors.put(InputSource.class, new InputSourceEditor());
		this.defaultEditors.put(Locale.class, new LocaleEditor());
		this.defaultEditors.put(Pattern.class, new PatternEditor());
		this.defaultEditors.put(Properties.class, new PropertiesEditor());
		this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor());
		this.defaultEditors.put(TimeZone.class, new TimeZoneEditor());
		this.defaultEditors.put(URI.class, new URIEditor());
		this.defaultEditors.put(URL.class, new URLEditor());
		this.defaultEditors.put(UUID.class, new UUIDEditor());

		this.defaultEditors.put(Collection.class, new CustomCollectionEditor(Collection.class));
		this.defaultEditors.put(Set.class, new CustomCollectionEditor(Set.class));
		this.defaultEditors.put(SortedSet.class, new CustomCollectionEditor(SortedSet.class));
		this.defaultEditors.put(List.class, new CustomCollectionEditor(List.class));
		this.defaultEditors.put(SortedMap.class, new CustomMapEditor(SortedMap.class));

		this.defaultEditors.put(byte[].class, new ByteArrayPropertyEditor());
		this.defaultEditors.put(char[].class, new CharArrayPropertyEditor());

		this.defaultEditors.put(char.class, new CharacterEditor(false));
		this.defaultEditors.put(Character.class, new CharacterEditor(true));

		this.defaultEditors.put(boolean.class, new CustomBooleanEditor(false));
		this.defaultEditors.put(Boolean.class, new CustomBooleanEditor(true));

		this.defaultEditors.put(byte.class, new CustomNumberEditor(Byte.class, false));
		this.defaultEditors.put(Byte.class, new CustomNumberEditor(Byte.class, true));
		this.defaultEditors.put(short.class, new CustomNumberEditor(Short.class, false));
		this.defaultEditors.put(Short.class, new CustomNumberEditor(Short.class, true));
		this.defaultEditors.put(int.class, new CustomNumberEditor(Integer.class, false));
		this.defaultEditors.put(Integer.class, new CustomNumberEditor(Integer.class, true));
		this.defaultEditors.put(long.class, new CustomNumberEditor(Long.class, false));
		this.defaultEditors.put(Long.class, new CustomNumberEditor(Long.class, true));
		this.defaultEditors.put(float.class, new CustomNumberEditor(Float.class, false));
		this.defaultEditors.put(Float.class, new CustomNumberEditor(Float.class, true));
		this.defaultEditors.put(double.class, new CustomNumberEditor(Double.class, false));
		this.defaultEditors.put(Double.class, new CustomNumberEditor(Double.class, true));
		this.defaultEditors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, true));
		this.defaultEditors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));
		
		this.defaultEditors.put(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
		this.defaultEditors.put(Timestamp.class, new CustomTimestampEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
	} 


    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(UuidList.class, new UUIDListPropertyEditor());
        binder.registerCustomEditor(UUID.class, new UUIDEditor());
    } 

	private void createDefaultEditors() {
		this.editors = new ConcurrentHashMap<Class, PropertyEditor>(64);

		this.editors.put(Charset.class, new CharsetEditor());
		this.editors.put(Class.class, new ClassEditor());
		this.editors.put(Class[].class, new ClassArrayEditor());
		this.editors.put(Currency.class, new CurrencyEditor());
		this.editors.put(File.class, new FileEditor());
		this.editors.put(InputStream.class, new InputStreamEditor());
		this.editors.put(InputSource.class, new InputSourceEditor());
		this.editors.put(Locale.class, new LocaleEditor());
		this.editors.put(Pattern.class, new PatternEditor());
		this.editors.put(Properties.class, new PropertiesEditor());
		this.editors.put(Resource[].class, new ResourceArrayPropertyEditor());
		this.editors.put(TimeZone.class, new TimeZoneEditor());
		this.editors.put(URI.class, new URIEditor());
		this.editors.put(URL.class, new URLEditor());
		this.editors.put(UUID.class, new UUIDEditor());

		this.editors.put(Collection.class, new CustomCollectionEditor(Collection.class));
		this.editors.put(Set.class, new CustomCollectionEditor(Set.class));
		this.editors.put(SortedSet.class, new CustomCollectionEditor(SortedSet.class));
		this.editors.put(List.class, new CustomCollectionEditor(List.class));
		this.editors.put(SortedMap.class, new CustomMapEditor(SortedMap.class));

		this.editors.put(byte[].class, new ByteArrayPropertyEditor());
		this.editors.put(char[].class, new CharArrayPropertyEditor());

		this.editors.put(char.class, new CharacterEditor(false));
		this.editors.put(Character.class, new CharacterEditor(true));

		this.editors.put(boolean.class, new CustomBooleanEditor(false));
		this.editors.put(Boolean.class, new CustomBooleanEditor(true));

		this.editors.put(byte.class, new CustomNumberEditor(Byte.class, false));
		this.editors.put(Byte.class, new CustomNumberEditor(Byte.class, true));
		this.editors.put(short.class, new CustomNumberEditor(Short.class, false));
		this.editors.put(Short.class, new CustomNumberEditor(Short.class, true));
		this.editors.put(int.class, new CustomNumberEditor(Integer.class, false));
		this.editors.put(Integer.class, new CustomNumberEditor(Integer.class, true));
		this.editors.put(long.class, new CustomNumberEditor(Long.class, false));
		this.editors.put(Long.class, new CustomNumberEditor(Long.class, true));
		this.editors.put(float.class, new CustomNumberEditor(Float.class, false));
		this.editors.put(Float.class, new CustomNumberEditor(Float.class, true));
		this.editors.put(double.class, new CustomNumberEditor(Double.class, false));
		this.editors.put(Double.class, new CustomNumberEditor(Double.class, true));
		this.editors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, true));
		this.editors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));

		StringArrayPropertyEditor sae = new StringArrayPropertyEditor();
		this.editors.put(String[].class, sae);
		this.editors.put(short[].class, sae);
		this.editors.put(int[].class, sae);
		this.editors.put(long[].class, sae);
	} 

    public ConfigPropertyInjector() {
        this.editors = new HashMap<Class<?>, PropertyEditor>(64);

        this.editors.put(Charset.class, new CharsetEditor());
        this.editors.put(Class.class, new ClassEditor());
        this.editors.put(Class[].class, new ClassArrayEditor());
        this.editors.put(Currency.class, new CurrencyEditor());
        this.editors.put(File.class, new FileEditor());
        this.editors.put(InputStream.class, new InputStreamEditor());
        this.editors.put(InputSource.class, new InputSourceEditor());
        this.editors.put(Locale.class, new LocaleEditor());
        this.editors.put(Pattern.class, new PatternEditor());
        this.editors.put(Properties.class, new PropertiesEditor());
        this.editors.put(Reader.class, new ReaderEditor());
        this.editors.put(Resource[].class, new ResourceArrayPropertyEditor());
        this.editors.put(TimeZone.class, new TimeZoneEditor());
        this.editors.put(URI.class, new URIEditor());
        this.editors.put(URL.class, new URLEditor());
        this.editors.put(UUID.class, new UUIDEditor());
        this.editors.put(Collection.class, new CustomCollectionEditor(Collection.class));
        this.editors.put(Set.class, new CustomCollectionEditor(Set.class));
        this.editors.put(SortedSet.class, new CustomCollectionEditor(SortedSet.class));
        this.editors.put(List.class, new CustomCollectionEditor(List.class));
        this.editors.put(SortedMap.class, new CustomMapEditor(SortedMap.class));
        this.editors.put(byte[].class, new ByteArrayPropertyEditor());
        this.editors.put(char[].class, new CharArrayPropertyEditor());
        this.editors.put(char.class, new CharacterEditor(false));
        this.editors.put(Character.class, new CharacterEditor(true));
        this.editors.put(boolean.class, new CustomBooleanEditor(false));
        this.editors.put(Boolean.class, new CustomBooleanEditor(true));
        this.editors.put(byte.class, new CustomNumberEditor(Byte.class, false));
        this.editors.put(Byte.class, new CustomNumberEditor(Byte.class, true));
        this.editors.put(short.class, new CustomNumberEditor(Short.class, false));
        this.editors.put(Short.class, new CustomNumberEditor(Short.class, true));
        this.editors.put(int.class, new CustomNumberEditor(Integer.class, false));
        this.editors.put(Integer.class, new CustomNumberEditor(Integer.class, true));
        this.editors.put(long.class, new CustomNumberEditor(Long.class, false));
        this.editors.put(Long.class, new CustomNumberEditor(Long.class, true));
        this.editors.put(float.class, new CustomNumberEditor(Float.class, false));
        this.editors.put(Float.class, new CustomNumberEditor(Float.class, true));
        this.editors.put(double.class, new CustomNumberEditor(Double.class, false));
        this.editors.put(Double.class, new CustomNumberEditor(Double.class, true));
        this.editors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, true));
        this.editors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));
    } 

Advertisement
Javadoc
Editor for java.util.UUID, translating UUID String representations into UUID objects and back. @auth

or Juergen Hoeller @since 3.0.1 @see java.util.UUID

Read More
Advertisement