Package java.beans

Examples of java.beans.IndexedPropertyDescriptor


                *  Step 5.10.2.2: Handle special case, When property is Boolean object (not boolean primitive) and getter method starts with "is"
                *  This is not standard boolean declaration. But logical to do in hand written bean. Then support it.
                */
                 if(accessor == null){
                   if(property instanceof IndexedPropertyDescriptor){
                     IndexedPropertyDescriptor idexedProp = (IndexedPropertyDescriptor)property;
                     accessor    = idexedProp.getReadMethod();
                     propertyType   = idexedProp.getIndexedPropertyType();
                   }else if(propertyType.isAssignableFrom(Boolean.class)){
                     // for Boolean Objet is method issue
                     try{
                       accessor = clazz.getMethod("is"+name.substring(0, 1).toUpperCase()+name.substring(1),((Class[])null));
                     }catch(Throwable th){/*Not an issue if not read method*/}
 
View Full Code Here


      throw new BeanException("No such property:" + name);
    }

    if (pd instanceof IndexedPropertyDescriptor && name.getIndex() != null)
    {
      final IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
      final Method readMethod = ipd.getIndexedReadMethod();
      if (readMethod == null)
      {
        throw new BeanException("Property is not readable: " + name);
      }
      try
View Full Code Here

      throw new BeanException("No such property:" + name);
    }

    if (pd instanceof IndexedPropertyDescriptor && name.getIndex() != null)
    {
      final IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
      final Method writeMethod = ipd.getIndexedWriteMethod();
      if (writeMethod != null)
      {
        try
        {
          writeMethod.invoke(bean, new Object[]{new Integer(name.getIndex()), o});
View Full Code Here

    {
      return typeFromDescriptor;
    }
    if (pd instanceof IndexedPropertyDescriptor)
    {
      final IndexedPropertyDescriptor idx = (IndexedPropertyDescriptor) pd;
      return idx.getIndexedPropertyType();
    }
    throw new BeanException("Unable to determine the property type.");
  }
View Full Code Here

              "getShowDriversToolBar", "setShowDriversToolBar"),
            new PropertyDescriptor(SHOW_TOOLTIPS, SquirrelPreferences.class, "getShowToolTips",
              "setShowToolTips"),
            new PropertyDescriptor(SCROLLABLE_TABBED_PANES, SquirrelPreferences.class,
              "getUseScrollableTabbedPanes", "setUseScrollableTabbedPanes"),
            new IndexedPropertyDescriptor(ACTION_KEYS, SquirrelPreferences.class, "getActionKeys",
              "setActionKeys", "getActionKeys", "setActionKeys"),
            new PropertyDescriptor(PROXY, SquirrelPreferences.class, "getProxySettings",
              "setProxySettings"),
            new PropertyDescriptor(UPDATE, SquirrelPreferences.class, "getUpdateSettings",
              "setUpdateSettings"),
            new PropertyDescriptor(SHOW_LOADED_DRIVERS_ONLY, SquirrelPreferences.class,
              "getShowLoadedDriversOnly", "setShowLoadedDriversOnly"),
            new PropertyDescriptor(MAXIMIMIZE_SESSION_SHEET_ON_OPEN, SquirrelPreferences.class,
              "getMaximizeSessionSheetOnOpen", "setMaximizeSessionSheetOnOpen"),
            new PropertyDescriptor(SHOW_COLOR_ICONS_IN_TOOLBAR, SquirrelPreferences.class,
              "getShowColoriconsInToolbar", "setShowColoriconsInToolbar"),
            new PropertyDescriptor(FIRST_RUN, SquirrelPreferences.class, "isFirstRun", "setFirstRun"),
            new PropertyDescriptor(CONFIRM_SESSION_CLOSE, SquirrelPreferences.class,
              "getConfirmSessionClose", "setConfirmSessionClose"),
            new IndexedPropertyDescriptor(PLUGIN_STATUSES, SquirrelPreferences.class,
              "getPluginStatuses", "setPluginStatuses", "getPluginStatus", "setPluginStatus"),
            new PropertyDescriptor(NEW_SESSION_VIEW, SquirrelPreferences.class, "getNewSessionView",
              "setNewSessionView"),
            new PropertyDescriptor(FILE_OPEN_IN_PREVIOUS_DIR, SquirrelPreferences.class,
              "isFileOpenInPreviousDir", "setFileOpenInPreviousDir"),
View Full Code Here

      result[3] = new PropertyDescriptor(IPropertyNames.URL, SQLDriver.class, "getUrl", "setUrl");
      result[4] =
        new PropertyDescriptor(IPropertyNames.JARFILE_NAME, SQLDriver.class, "getJarFileName",
          "setJarFileName");
      result[5] =
        new IndexedPropertyDescriptor(IPropertyNames.JARFILE_NAMES, SQLDriver.class,
          "getJarFileNameWrappers", "setJarFileNameWrappers", "getJarFileNameWrapper",
          "setJarFileNameWrapper");
      result[6] =
        new PropertyDescriptor(IPropertyNames.WEBSITE_URL, SQLDriver.class, "getWebSiteUrl",
          "setWebSiteUrl");
View Full Code Here

  public PropertyDescriptor[] getPropertyDescriptors()
  {
    try
    {
      PropertyDescriptor[] result = new PropertyDescriptor[1];
      result[0] = new IndexedPropertyDescriptor(IPropNames.DRIVER_PROPERTIES,
        SQLDriverPropertyCollection.class,
              "getDriverProperties", "setDriverProperties",
              "getDriverProperty", "setDriverProperty");
      return result;
    }
View Full Code Here

    }

    private void populateClassMapWithPropertyDescriptor(PropertyDescriptor pd,
            Class clazz, Map accessibleMethods, Map classMap) {
        if(pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd =
                (IndexedPropertyDescriptor)pd;
            Method readMethod = ipd.getIndexedReadMethod();
            Method publicReadMethod = getAccessibleMethod(readMethod,
                    accessibleMethods);
            if(publicReadMethod != null && isSafeMethod(publicReadMethod)) {
                try {
                    if(readMethod != publicReadMethod) {
                        ipd = new IndexedPropertyDescriptor(
                                ipd.getName(), ipd.getReadMethod(),
                                ipd.getWriteMethod(), publicReadMethod,
                                ipd.getIndexedWriteMethod());
                    }
                    classMap.put(ipd.getName(), ipd);
                    getArgTypes(classMap).put(publicReadMethod,
                            publicReadMethod.getParameterTypes());
                }
                catch(IntrospectionException e) {
                    logger.warn("Failed creating a publicly-accessible " +
                            "property descriptor for " + clazz.getName() +
                            " indexed property " + pd.getName() +
                            ", read method " + publicReadMethod +
                            ", write method " + ipd.getIndexedWriteMethod(),
                            e);
                }
            }
        }
        else {
View Full Code Here

    private static Logger LOGGER = LoggerFactory.instance(IndexedCommand.class
            .getName());

    @Override
  void set(PropertyMapping mapping, Object value) throws BeanException {
        IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)getDescriptor(
                mapping.getBean(), mapping.getKey());

        if (descriptor != null) {
            Method setMethod = descriptor.getIndexedWriteMethod();
            Class<?> type = descriptor.getIndexedPropertyType();
            int index = KeyHelper.getIndex(mapping.getKey());

            try {
                Object convertedValue = Converter.convertValueToType(value,
                        type);
View Full Code Here

        }
    }

    @Override
  Object get(PropertyMapping mapping) throws BeanException {
        IndexedPropertyDescriptor descriptor = (IndexedPropertyDescriptor)getDescriptor(
                mapping.getBean(), mapping.getKey());

        if (descriptor != null) {
            try {
                Method getMethod = descriptor.getIndexedReadMethod();
                int index = KeyHelper.getIndex(mapping.getKey());

                return getMethod.invoke(mapping.getBean(),
                        new Object[] { Integer.valueOf(index) });
            } catch (Exception e) {
View Full Code Here

TOP

Related Classes of java.beans.IndexedPropertyDescriptor

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.