Package java.beans

Examples of java.beans.PropertyEditor


    assertEquals(GigaSpacesCachingModel.class, modelEditor.getCacheModelClass());
    assertNull(modelEditor.getCacheModelPropertyEditors());
  }

  public void testGetFlushingModelEditor() {
    PropertyEditor editor = facade.getFlushingModelEditor();

    assertNotNull(editor);
    assertEquals(ReflectionCacheModelEditor.class, editor.getClass());

    ReflectionCacheModelEditor modelEditor = (ReflectionCacheModelEditor) editor;
    assertEquals(GigaSpacesFlushingModel.class, modelEditor.getCacheModelClass());
  Map propertyEditors = modelEditor.getCacheModelPropertyEditors();
  assertEquals(1, propertyEditors.size());
View Full Code Here


    }
    verify();
  }

  public void testGetCachingModelEditor() {
    PropertyEditor editor = jcsFacade.getCachingModelEditor();

    assertNotNull(editor);
    assertEquals(ReflectionCacheModelEditor.class, editor.getClass());

    ReflectionCacheModelEditor modelEditor = (ReflectionCacheModelEditor) editor;
    assertEquals(JcsCachingModel.class, modelEditor.getCacheModelClass());
    assertNull(modelEditor.getCacheModelPropertyEditors());
  }
View Full Code Here

    assertEquals(JcsCachingModel.class, modelEditor.getCacheModelClass());
    assertNull(modelEditor.getCacheModelPropertyEditors());
  }

  public void testGetFlushingModelEditor() {
    PropertyEditor editor = jcsFacade.getFlushingModelEditor();
    assertNotNull(editor);
    assertEquals(JcsFlushingModelEditor.class, editor.getClass());
  }
View Full Code Here

      // we are expecting this exception.
    }
  }

  public void testGetCachingModelEditor() {
    PropertyEditor editor = cacheFacade.getCachingModelEditor();

    assertNotNull(editor);
    assertEquals(ReflectionCacheModelEditor.class, editor.getClass());

    ReflectionCacheModelEditor modelEditor = (ReflectionCacheModelEditor) editor;
    assertEquals(EhCacheCachingModel.class, modelEditor.getCacheModelClass());
    assertNull(modelEditor.getCacheModelPropertyEditors());
  }
View Full Code Here

    assertEquals(EhCacheCachingModel.class, modelEditor.getCacheModelClass());
    assertNull(modelEditor.getCacheModelPropertyEditors());
  }

  public void testGetFlushingModelEditor() {
    PropertyEditor editor = cacheFacade.getFlushingModelEditor();

    assertNotNull(editor);
    assertEquals(ReflectionCacheModelEditor.class, editor.getClass());

    ReflectionCacheModelEditor modelEditor = (ReflectionCacheModelEditor) editor;
    assertEquals(EhCacheFlushingModel.class, modelEditor.getCacheModelClass());
    Map propertyEditors = modelEditor.getCacheModelPropertyEditors();
    assertEquals(1, propertyEditors.size());
View Full Code Here

        String propertyName = (String) i.next();
        String textProperty = properties.getProperty(propertyName);

        Object propertyValue = null;

        PropertyEditor propertyEditor = getPropertyEditor(propertyName);
        if (propertyEditor != null) {
          propertyEditor.setAsText(textProperty);
          propertyValue = propertyEditor.getValue();
        } else {
          propertyValue = textProperty;
        }
        beanWrapper.setPropertyValue(propertyName, propertyValue);
      }
View Full Code Here

    assertNotNull(validator);
    assertEquals(JbossCacheModelValidator.class, validator.getClass());
  }

  public void testGetCachingModelEditor() {
    PropertyEditor editor = cacheFacade.getCachingModelEditor();

    assertNotNull(editor);
    assertEquals(ReflectionCacheModelEditor.class, editor.getClass());

    ReflectionCacheModelEditor modelEditor = (ReflectionCacheModelEditor) editor;
    assertEquals(JbossCacheCachingModel.class, modelEditor.getCacheModelClass());
    assertNull(modelEditor.getCacheModelPropertyEditors());
  }
View Full Code Here

        Iterator entries = customEditors.entrySet().iterator();
        while(entries.hasNext()) {
            Map.Entry entry = (Map.Entry) entries.next();
            String value = (String) entry.getValue();
            if (applicationContext.getBean(value) instanceof PropertyEditor && ! applicationContext.isSingleton(value)) {
                PropertyEditor editor = (PropertyEditor) applicationContext.getBean(value);
                String key = (String) entry.getKey();
                String[] splittedKey = key.split(QUALIFIER_SEPARATOR);
                if (splittedKey.length == 2) {
                    String qualifier = splittedKey[0];
                    String keyValue = splittedKey[1];
View Full Code Here

        if (targetType.isInstance(value)) {
            return targetType.cast(value);
        }

        if (value instanceof String) {
            PropertyEditor editor = PropertyEditorManager.findEditor(targetType);
            if (editor == null && Primitives.isWrapperType(targetType)) {
                editor = PropertyEditorManager.findEditor(Primitives.unwrap(targetType));
            }

            if (editor != null) {

                editor.setAsText((String) value);
                return targetType.cast(editor.getValue());
            } else if (targetType.isEnum()) {
                return targetType.cast(Enum.valueOf((Class<Enum>) targetType, (String) value));
            }
        }
View Full Code Here

        if (obj == null)
            return null;
        if (obj instanceof String) {
            if ("".equals(obj))
                return null;
            PropertyEditor editor = PropertyEditorManager.findEditor(type);
            if (editor != null) {
                editor.setAsText((String) obj);
                return editor.getValue();
            }
        }
        throw new IllegalArgumentException(MessageFactory.get("error.convert",
                obj, obj.getClass(), type));
    }
View Full Code Here

TOP

Related Classes of java.beans.PropertyEditor

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.