Examples of PropertyDescriptor


Examples of java.beans.PropertyDescriptor

        {
            writeMethod = (Method)classWriteMethods.get(name);
        }
        if (writeMethod == null)
        {
            final PropertyDescriptor descriptor = this.getPropertyDescriptor(
                    object.getClass(),
                    name);
            writeMethod = descriptor != null ? descriptor.getWriteMethod() : null;
            if (writeMethod != null)
            {
                classWriteMethods.put(
                    name,
                    writeMethod);
View Full Code Here

Examples of java.beans.PropertyDescriptor

        {
            readMethod = (Method)classReadMethods.get(name);
        }
        if (readMethod == null)
        {
            final PropertyDescriptor descriptor = this.getPropertyDescriptor(
                    object.getClass(),
                    name);
            readMethod = descriptor != null ? descriptor.getReadMethod() : null;
            if (readMethod != null)
            {
                classReadMethods.put(
                    name,
                    readMethod);
View Full Code Here

Examples of java.beans.PropertyDescriptor

     */
    private PropertyDescriptor getPropertyDescriptor(
        final Class type,
        final String name)
    {
        PropertyDescriptor propertyDescriptor = null;
        Map classPropertyDescriptors = (Map)this.propertyDescriptorsCache.get(type);
        if (classPropertyDescriptors == null)
        {
            classPropertyDescriptors = new HashMap();
        }
        else
        {
            propertyDescriptor = (PropertyDescriptor)classPropertyDescriptors.get(name);
        }
       
        if (propertyDescriptor == null)
        {
            try
            {
                final PropertyDescriptor[] descriptors =
                    java.beans.Introspector.getBeanInfo(type).getPropertyDescriptors();
                final int descriptorNumber = descriptors.length;
                for (int ctr = 0; ctr < descriptorNumber; ctr++)
                {
                    final PropertyDescriptor descriptor = descriptors[ctr];

                    // - handle names that start with a lowercased letter and have an uppercase as the second letter
                    final String compareName =
                        name.matches("\\p{Lower}\\p{Upper}.*") ? StringUtils.capitalize(name) : name;
                    if (descriptor.getName().equals(compareName))
                    {
                        propertyDescriptor = descriptor;
                        break;
                    }
                }
                if (propertyDescriptor == null && name.indexOf(NESTED_DELIMITER) != -1)
                {
                    int dotIndex = name.indexOf(NESTED_DELIMITER);
                    if (dotIndex >= name.length())
                    {
                        throw new IntrospectorException("Invalid property call --> '" + name + "'");
                    }
                    final PropertyDescriptor nextInstance =
                        this.getPropertyDescriptor(
                            type,
                            name.substring(
                                0,
                                dotIndex));
                    propertyDescriptor =
                        this.getPropertyDescriptor(
                            nextInstance.getPropertyType(),
                            name.substring(dotIndex + 1));
                }
            }
            catch (final java.beans.IntrospectionException exception)
            {
View Full Code Here

Examples of java.beans.PropertyDescriptor

        if (object != null || name != null || name.length() > 0)
        {
            Class expectedType = null;
            if (value != null)
            {
                final PropertyDescriptor descriptor = this.getPropertyDescriptor(
                        object.getClass(),
                        name);
                if (descriptor != null)
                {
                    expectedType = this.getPropertyDescriptor(
View Full Code Here

Examples of java.beans.PropertyDescriptor

  {
    try
    {
      PropertyDescriptor[] result =
        new PropertyDescriptor[] {
            new PropertyDescriptor(IPropNames.AUTO_COMMIT, SessionProperties.class, "getAutoCommit",
              "setAutoCommit"),
            new PropertyDescriptor(IPropNames.COMMIT_ON_CLOSING_CONNECTION, SessionProperties.class,
              "getCommitOnClosingConnection", "setCommitOnClosingConnection"),
            new PropertyDescriptor(IPropNames.CONTENTS_LIMIT_ROWS, SessionProperties.class,
              "getContentsLimitRows", "setContentsLimitRows"),
            new PropertyDescriptor(IPropNames.CONTENTS_NBR_ROWS_TO_SHOW, SessionProperties.class,
              "getContentsNbrRowsToShow", "setContentsNbrRowsToShow"),
            new PropertyDescriptor(IPropNames.FONT_INFO, SessionProperties.class, "getFontInfo",
              "setFontInfo"),
            new PropertyDescriptor(IPropNames.META_DATA_OUTPUT_CLASS_NAME, SessionProperties.class,
              "getMetaDataOutputClassName", "setMetaDataOutputClassName"),
            new PropertyDescriptor(IPropNames.SHOW_ROW_COUNT, SessionProperties.class,
              "getShowRowCount", "setShowRowCount"),
            new PropertyDescriptor(IPropNames.SHOW_TOOL_BAR, SessionProperties.class, "getShowToolBar",
              "setShowToolBar"),
            new PropertyDescriptor(IPropNames.SQL_LIMIT_ROWS, SessionProperties.class,
              "getSQLLimitRows", "setSQLLimitRows"),
            new PropertyDescriptor(IPropNames.SQL_NBR_ROWS_TO_SHOW, SessionProperties.class,
              "getSQLNbrRowsToShow", "setSQLNbrRowsToShow"),
            new PropertyDescriptor(IPropNames.SQL_STATEMENT_SEPARATOR_STRING, SessionProperties.class,
              "getSQLStatementSeparator", "setSQLStatementSeparator"),
            new PropertyDescriptor(IPropNames.SQL_RESULTS_OUTPUT_CLASS_NAME, SessionProperties.class,
              "getSQLResultsOutputClassName", "setSQLResultsOutputClassName"),
            new PropertyDescriptor(IPropNames.SQL_START_OF_LINE_COMMENT, SessionProperties.class,
              "getStartOfLineComment", "setStartOfLineComment"),
            new PropertyDescriptor(IPropNames.REMOVE_MULTI_LINE_COMMENT, SessionProperties.class,
              "getRemoveMultiLineComment", "setRemoveMultiLineComment"),
            new PropertyDescriptor(IPropNames.LIMIT_SQL_ENTRY_HISTORY_SIZE, SessionProperties.class,
              "getLimitSQLEntryHistorySize", "setLimitSQLEntryHistorySize"),
            new PropertyDescriptor(IPropNames.SQL_ENTRY_HISTORY_SIZE, SessionProperties.class,
              "getSQLEntryHistorySize", "setSQLEntryHistorySize"),
            new PropertyDescriptor(IPropNames.SQL_SHARE_HISTORY, SessionProperties.class,
              "getSQLShareHistory", "setSQLShareHistory"),
            new PropertyDescriptor(IPropNames.MAIN_TAB_PLACEMENT, SessionProperties.class,
              "getMainTabPlacement", "setMainTabPlacement"),
            new PropertyDescriptor(IPropNames.OBJECT_TAB_PLACEMENT, SessionProperties.class,
              "getObjectTabPlacement", "setObjectTabPlacement"),
            new PropertyDescriptor(IPropNames.SQL_EXECUTION_TAB_PLACEMENT, SessionProperties.class,
              "getSQLExecutionTabPlacement", "setSQLExecutionTabPlacement"),
            new PropertyDescriptor(IPropNames.SQL_RESULTS_TAB_PLACEMENT, SessionProperties.class,
              "getSQLResultsTabPlacement", "setSQLResultsTabPlacement"),
            new PropertyDescriptor(IPropNames.SQL_USE_FETCH_SIZE, SessionProperties.class,
              "getSQLFetchSize", "setSQLFetchSize"),
            new PropertyDescriptor(IPropNames.SQL_FETCH_SIZE, SessionProperties.class,
              "getSQLUseFetchSize", "setSQLUseFetchSize"),
            new PropertyDescriptor(IPropNames.TABLE_CONTENTS_OUTPUT_CLASS_NAME,
              SessionProperties.class, "getTableContentsOutputClassName",
              "setTableContentsOutputClassName"),
            new PropertyDescriptor(IPropNames.KEEP_TABLE_LAYOUT_ON_RERUN,
              SessionProperties.class, "getKeepTableLayoutOnRerun",
              "setKeepTableLayoutOnRerun"),
            new PropertyDescriptor(IPropNames.ABORT_ON_ERROR, SessionProperties.class,
              "getAbortOnError", "setAbortOnError"),
            new PropertyDescriptor(IPropNames.SQL_RESULT_TAB_LIMIT, SessionProperties.class,
              "getSqlResultTabLimit", "setSqlResultTabLimit"),
            new PropertyDescriptor(IPropNames.LIMIT_SQL_RESULT_TABS, SessionProperties.class,
              "getLimitSQLResultTabs", "setLimitSQLResultTabs"),
            new PropertyDescriptor(IPropNames.LOAD_SCHEMAS_CATALOGS, SessionProperties.class,
              "getLoadSchemasCatalogs", "setLoadSchemasCatalogs"),
            new PropertyDescriptor(IPropNames.SHOW_RESULTS_META_DATA, SessionProperties.class,
              "getShowResultsMetaData", "setShowResultsMetaData"),

            new PropertyDescriptor(IPropNames.CATALOG_FILTER_INCLUDE, SessionProperties.class,
              "getCatalogFilterInclude", "setCatalogFilterInclude"),
            new PropertyDescriptor(IPropNames.SCHEMA_FILTER_INCLUDE, SessionProperties.class,
              "getSchemaFilterInclude", "setSchemaFilterInclude"),
            new PropertyDescriptor(IPropNames.OBJECT_FILTER_INCLUDE, SessionProperties.class,
              "getObjectFilterInclude", "setObjectFilterInclude"),
            new PropertyDescriptor(IPropNames.CATALOG_FILTER_EXCLUDE, SessionProperties.class,
              "getCatalogFilterExclude", "setCatalogFilterExclude"),
            new PropertyDescriptor(IPropNames.SCHEMA_FILTER_EXCLUDE, SessionProperties.class,
              "getSchemaFilterExclude", "setSchemaFilterExclude"),
            new PropertyDescriptor(IPropNames.OBJECT_FILTER_EXCLUDE, SessionProperties.class,
              "getObjectFilterExclude", "setObjectFilterExclude"),

            new PropertyDescriptor(IPropNames.LOAD_COLUMNS_IN_BACKGROUND, SessionProperties.class,
              "getLoadColumnsInBackground", "setLoadColumnsInBackground")
            };

      return result;
    }
View Full Code Here

Examples of javax.validation.metadata.PropertyDescriptor

            if (valueExpression != null) {
                ValueExpressionAnalyzer valueExpressionAnalyzer = new ValueExpressionAnalyzer(valueExpression);
                ValueReference vref = valueExpressionAnalyzer.getValueReference(context.getELContext());
                if (vref != null) { // valueExpressionAnalyzer can return a null value. The condition prevents a NPE
                    BeanDescriptor constraintsForClass = validator.getConstraintsForClass(vref.getBase().getClass());
                    PropertyDescriptor d = constraintsForClass.getConstraintsForProperty((String) vref.getProperty());
                    return (d != null) && d.hasConstraints();
                }
            }
            return false;
        }
View Full Code Here

Examples of jodd.introspector.PropertyDescriptor

    PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors();

    String[] names = new String[propertyDescriptors.length];

    for (int i = 0; i < propertyDescriptors.length; i++) {
      PropertyDescriptor propertyDescriptor = propertyDescriptors[i];

      MethodDescriptor getter = propertyDescriptor.getReadMethodDescriptor();
      if (getter != null) {
        if (getter.matchDeclared(declared)) {
          names[i] = propertyDescriptor.getName();
        }
      }
    }

    return names;
View Full Code Here

Examples of modTransf.model.reflect.PropertyDescriptor

   */
  public Object getProperty(Object bean, String name)
    throws ModelException
  {
    // Check if there is a registered property.
    PropertyDescriptor desc = getPropertyExtension(bean, name);
    if(desc==null)
    {
      throw new NotFoundException("No registered extension for property ('"
                                  +name+"', '"+bean.getClass().getName()
                                  +"').");
    }

    // Get the value.
      return desc.get(bean);
  }
View Full Code Here

Examples of org.apache.aries.blueprint.utils.ReflectionUtils.PropertyDescriptor

    }

    private void setProperty(Object instance, Class clazz, String propertyName, Object propertyValue) {
        String[] names = propertyName.split("\\.");
        for (int i = 0; i < names.length - 1; i++) {
            PropertyDescriptor pd = getPropertyDescriptor(clazz, names[i]);
            if (pd.allowsGet()) {
                try {
                    instance = pd.get(instance, blueprintContainer);
                } catch (Exception e) {
                    throw new ComponentDefinitionException("Error getting property: " + names[i] + " on bean " + getName() + " when setting property " + propertyName + " on class " + clazz.getName(), getRealCause(e));
                }
                if (instance == null) {
                    throw new ComponentDefinitionException("Error setting compound property " + propertyName + " on bean " + getName() + ". Property " + names[i] + " is null");
                }
                clazz = instance.getClass();
            } else {
                throw new ComponentDefinitionException("No getter for " + names[i] + " property on bean " + getName() + " when setting property " + propertyName + " on class " + clazz.getName());
            }
        }
       
        // Instantiate value
        if (propertyValue instanceof Recipe) {
            propertyValue = ((Recipe) propertyValue).create();
        }

        final PropertyDescriptor pd = getPropertyDescriptor(clazz, names[names.length - 1]);
        if (pd.allowsSet()) {
            try {
                pd.set(instance, propertyValue, blueprintContainer);
            } catch (Exception e) {
                throw new ComponentDefinitionException("Error setting property: " + pd, getRealCause(e));
            }
        } else {
            throw new ComponentDefinitionException("No setter for " + names[names.length - 1] + " property");
View Full Code Here

Examples of org.apache.cayenne.reflect.PropertyDescriptor

        // translate ObjectContext generic property change callback to GraphManager terms
        // (simple properties vs. relationships)

        ClassDescriptor descriptor = context.getEntityResolver().getClassDescriptor(
                object.getObjectId().getEntityName());
        PropertyDescriptor property = descriptor.getProperty(propertyName);

        if (property instanceof ArcProperty) {
            handleArcPropertyChange(object, (ArcProperty) property, oldValue, newValue);
        }
        else {
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.