Package java.beans

Examples of java.beans.PropertyEditor


  @SuppressWarnings("unchecked")
  private ID getId(String idAsString) {

    Class<ID> idClass = information.getIdType();

    PropertyEditor idEditor = registry.findCustomEditor(idClass, null);

    if (idEditor != null) {
      idEditor.setAsText(idAsString);
      return (ID) idEditor.getValue();
    }

    return new SimpleTypeConverter().convertIfNecessary(idAsString, idClass);
  }
View Full Code Here


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

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

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

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

    assertEquals(CoherenceCachingModel.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(CoherenceFlushingModel.class, modelEditor.getCacheModelClass());
    Map propertyEditors = modelEditor.getCacheModelPropertyEditors();
    assertEquals(1, propertyEditors.size());
View Full Code Here

        BindStatusHelper helper = new BindStatusHelper("office.employees[0].matriculationCode", this.office);
        assertEquals("abc", helper.getStatusValue());
    }
   
    public void testGetStatusValueWithPropertyEditor() {
        PropertyEditor editor = new PropertyEditorSupport() {
           public String getAsText() {
               Employee emp = (Employee) this.getValue();
               return emp.getFirstname() + " " + emp.getSurname();
          
        };
View Full Code Here

    CacheModelValidator validator = cacheProviderFacade
        .modelValidator();

    if (flushingModels instanceof Properties) {
      PropertyEditor editor = cacheProviderFacade.getFlushingModelEditor();
      Properties properties = (Properties) flushingModels;
      Map newFlushingModels = new HashMap();

      String id = null;

      try {
        for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
          id = (String) i.next();

          String property = properties.getProperty(id);
          editor.setAsText(property);
          Object flushingModel = editor.getValue();
          validator.validateFlushingModel(flushingModel);

          newFlushingModels.put(id, flushingModel);
        }
      } catch (Exception exception) {
View Full Code Here

  public OsCacheFacadeTests(String name) {
    super(name);
  }

  public void testGetCacheModelEditor() {
    PropertyEditor editor = osCacheFacade.getCachingModelEditor();

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

    ReflectionCacheModelEditor modelEditor = (ReflectionCacheModelEditor) editor;
    assertEquals(OsCacheCachingModel.class, modelEditor.getCacheModelClass());

    Map cacheModelPropertyEditors = modelEditor.getCacheModelPropertyEditors();
    assertNotNull(cacheModelPropertyEditors);
    assertEquals(1, cacheModelPropertyEditors.size());

    PropertyEditor refreshPeriodEditor = (PropertyEditor) cacheModelPropertyEditors
        .get("refreshPeriod");
    assertNotNull(refreshPeriodEditor);
    assertEquals(RefreshPeriodEditor.class, refreshPeriodEditor.getClass());
  }
View Full Code Here

    assertEquals(OsCacheModelValidator.class, validator.getClass());
  }

  public void testGetFlushingModelEditor() {
    PropertyEditor editor = osCacheFacade.getFlushingModelEditor();
   
    assertNotNull(editor);
    assertEquals(ReflectionCacheModelEditor.class, editor.getClass());

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

    assertEquals(JbossCacheCachingModel.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(JbossCacheFlushingModel.class, modelEditor
        .getCacheModelClass());
    Map propertyEditors = modelEditor.getCacheModelPropertyEditors();
View Full Code Here

    for (int i = 0; i < listeners.length; i++)
      listeners[i].onCaching(key, cachedObject, m);
  }

  private Map propertiesToModels() {
    PropertyEditor editor = cache.getCachingModelEditor();
    Properties properties = (Properties) modelMap;

    Map m = new HashMap();
    for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
      String id = (String) i.next();
      editor.setAsText(properties.getProperty(id));
      m.put(id, editor.getValue());
    }
    return m;
  }
View Full Code Here

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

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

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

    ReflectionCacheModelEditor modelEditor = (ReflectionCacheModelEditor) editor;
    assertEquals(GigaSpacesCachingModel.class, modelEditor.getCacheModelClass());
    assertNull(modelEditor.getCacheModelPropertyEditors());
  }
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.