Examples of PropertyEditor


Examples of java.beans.PropertyEditor

        assertEquals(12345, ((BigInteger)o).intValue());
    }
   
    public void testJaxbNumberEditorGetValue() throws JAXBException {
        Object value = null;
        PropertyEditor pe = null;
       
        value = new Byte(Byte.MAX_VALUE);
        pe = new JaxbNumberEditor(Byte.class);
        helpTestGetValue(pe, value, "Byte");
       
View Full Code Here

Examples of java.beans.PropertyEditor

        helpTestGetValue(pe, value, "Float");     
    }
   
    public void testJaxbBooleanEditor() throws JAXBException {
        Object value = null;
        PropertyEditor pe = null;
       
        value = Boolean.TRUE;
        pe = new JaxbBooleanEditor();
        helpTestGetValue(pe, value, "Boolean");
    }
View Full Code Here

Examples of java.beans.PropertyEditor

       
        assertNull(map.get(StringListType.class));
       
        // all editors for primitive types registered
       
        PropertyEditor pe = null;
        PropertyEditor pe2 = null;
       
        pe = (PropertyEditor)map.get(String.class);
        assertTrue(pe instanceof JaxbPropertyEditor);
       
        pe = (PropertyEditor)map.get(BigInteger.class);
View Full Code Here

Examples of java.beans.PropertyEditor

                }

            }

            Method setter = clazz.getMethod("set" + name, new Class[] { type });
            PropertyEditor editor = PropertyEditorManager.findEditor(type);
            editor.setAsText(value);
            setter.invoke(xads, new Object[] { editor.getValue() });
        }
        return xads;
    }
View Full Code Here

Examples of java.beans.PropertyEditor

      int count = matchOp.getArgCount();
      Object[] params = new Object[count];
      for (int i = 0; i < count; i++)
      {
         String argType = matchOp.getArgType(i);
         PropertyEditor editor = PropertyEditors.getEditor(argType);
         editor.setAsText((String) opArgs.get(i));
         params[i] = editor.getValue();
      }
      log.debug("Using params: " + Strings.join(params, ","));
     
      // invoke the operation
      Object result = server.invoke(name, opName, params, matchOp.getSignature());
      log.debug("Raw result: " + result);

      if (!context.isQuiet())
      {
         // Translate the result to text
         String resultText = null;

         if (result != null)
         {
            try
            {
               PropertyEditor editor = PropertyEditors.getEditor(result.getClass());
               editor.setValue(result);
               resultText = editor.getAsText();
               log.debug("Converted result: " + resultText);
            }
            catch (RuntimeException e)
            {
               // No property editor found or some conversion problem
View Full Code Here

Examples of java.beans.PropertyEditor

   * @return the value in the correct representation
   * @throws Exception various :)
   */
  private Object convert (String val,String oType) throws Exception
  {
    PropertyEditor editor = PropertyEditors.getEditor(oType);
    editor.setAsText(val);
    return editor.getValue();   
  }
View Full Code Here

Examples of java.beans.PropertyEditor

            {
               log.warn("Unable to find class '" + type + "' for " + "property '" + name + "' - skipping property.");
               continue;
            }
         }
         PropertyEditor pe = PropertyEditorManager.findEditor(clazz);
         if (pe == null)
         {
            log.warn("Unable to find a PropertyEditor for class '" + clazz + "' of property '" + name + "' - "
                  + "skipping property");
            continue;
         }
         // TODO: should happen in parsing layer?
         value = StringPropertyReplacer.replaceProperties(value);
         log.debug("setting property: " + name + " to value " + value);
         try
         {
            pe.setAsText(value);
         }
         catch (IllegalArgumentException iae)
         {
            log.warn("Value '" + value + "' is not valid for property '" + name + "' of class '" + clazz
                  + "' - skipping " + "property");
            continue;
         }
         Object v = pe.getValue();
         setManagedConnectionFactoryAttribute(name, clazz, v, mustExist);
      }
   }
View Full Code Here

Examples of java.beans.PropertyEditor

               log.warn("Unable to find class '" + type + "' for " + "property '" + name
                     + "' - skipping property.");
               continue;
            }
         }
         PropertyEditor pe = PropertyEditorManager.findEditor(clazz);
         if (pe == null)
         {
            log.warn("Unable to find a PropertyEditor for class '" + clazz + "' of property '" + name + "' - "
                  + "skipping property");
            continue;
         }
         // TODO: should happen in parsing layer?
         value = StringPropertyReplacer.replaceProperties(value);
         log.debug("setting property: " + name + " to value " + value);
         try
         {
            pe.setAsText(value);
         }
         catch (IllegalArgumentException iae)
         {
            log.warn("Value '" + value + "' is not valid for property '" + name + "' of class '" + clazz
                  + "' - skipping " + "property");
            continue;
         }
         Object v = pe.getValue();
         setManagedConnectionFactoryAttribute(name, clazz, v);
     
      }
     
     
View Full Code Here

Examples of java.beans.PropertyEditor

         attr_info = findAttribute(attr_name, attribute_info);
         if (attr_info == null)
            throw new CommandException("attribute " + attr_name + " not found");
         type = attr_info.getType();

         PropertyEditor editor = PropertyEditors.getEditor(type);
         editor.setAsText((String) attr_value);
         real_value = editor.getValue();

         attr = new Attribute(attr_name, real_value);
         attrs.add(attr);
      }
View Full Code Here

Examples of java.beans.PropertyEditor

               type = String.class;
            }
         } // end of try-catch

         Method setter = clazz.getMethod("set" + name, new Class[]{type});
         PropertyEditor editor = PropertyEditorManager.findEditor(type);
         if(editor == null)
         {
            throw new JBossResourceException("No property editor found for type: " + type);
         } // end of if ()
         editor.setAsText(value);
         setter.invoke(xads, new Object[]{editor.getValue()});

      } // end of for ()
   }
   catch(ClassNotFoundException cnfe)
   {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.