Example usage for java.beans PropertyDescriptor getValue

List of usage examples for java.beans PropertyDescriptor getValue

Introduction

In this page you can find the example usage for java.beans PropertyDescriptor getValue.

Prototype

public Object getValue(String attributeName) 

Source Link

Document

Retrieve a named attribute with this feature.

Usage

From source file:com.twinsoft.convertigo.beans.core.MySimpleBeanInfo.java

protected PropertyDescriptor getPropertyDescriptor(String name) throws IntrospectionException {
    checkAdditionalProperties();//  www .  j  a va2s .co m
    for (int i = 0; i < properties.length; i++) {
        PropertyDescriptor property = properties[i];
        if (name.equals(property.getName())) {
            PropertyDescriptor clone = new PropertyDescriptor(name, property.getReadMethod(),
                    property.getWriteMethod());
            clone.setDisplayName(property.getDisplayName());
            clone.setShortDescription(property.getShortDescription());
            clone.setPropertyEditorClass(property.getPropertyEditorClass());
            clone.setBound(property.isBound());
            clone.setConstrained(property.isConstrained());
            clone.setExpert(property.isExpert());
            clone.setHidden(property.isHidden());
            clone.setPreferred(property.isPreferred());
            for (String attributeName : Collections.list(property.attributeNames())) {
                clone.setValue(attributeName, property.getValue(attributeName));
            }
            return properties[i] = clone;
        }
    }
    return null;
}

From source file:com.twinsoft.convertigo.beans.core.DatabaseObject.java

public boolean checkBlackListParentClass(PropertyDescriptor propertyDescriptor) {
    return parent != null && parent.getClass().getCanonicalName()
            .equals(propertyDescriptor.getValue(MySimpleBeanInfo.BLACK_LIST_PARENT_CLASS));
}

From source file:com.twinsoft.convertigo.beans.core.DatabaseObject.java

public static DatabaseObject read(Node node) throws EngineException {
    String objectClassName = "n/a";
    String childNodeName = "n/a";
    String propertyName = "n/a";
    String propertyValue = "n/a";
    DatabaseObject databaseObject = null;
    Element element = (Element) node;

    objectClassName = element.getAttribute("classname");

    // Migration to 4.x+ projects
    if (objectClassName.equals("com.twinsoft.convertigo.beans.core.ScreenClass")) {
        objectClassName = "com.twinsoft.convertigo.beans.screenclasses.JavelinScreenClass";
    }//  www  .  jav  a 2 s .  c  o  m

    String version = element.getAttribute("version");
    if ("".equals(version)) {
        version = node.getOwnerDocument().getDocumentElement().getAttribute("beans");
        if (!"".equals(version)) {
            element.setAttribute("version", version);
        }
    }
    // Verifying product version
    if (VersionUtils.compareProductVersion(Version.productVersion, version) < 0) {
        String message = "Unable to create an object of product version superior to the current beans product version ("
                + com.twinsoft.convertigo.beans.Version.version + ").\n" + "Object class: " + objectClassName
                + "\n" + "Object version: " + version;
        EngineException ee = new EngineException(message);
        throw ee;
    }

    try {
        Engine.logBeans.trace("Creating object of class \"" + objectClassName + "\"");
        databaseObject = (DatabaseObject) Class.forName(objectClassName).newInstance();
    } catch (Exception e) {
        String s = node.getNodeName();// XMLUtils.prettyPrintDOM(node);
        String message = "Unable to create a new instance of the object from the serialized XML data.\n"
                + "Object class: '" + objectClassName + "'\n" + "Object version: " + version + "\n"
                + "XML data:\n" + s;
        EngineException ee = new EngineException(message, e);
        throw ee;
    }

    try {
        // Performs custom configuration before object de-serialization
        databaseObject.preconfigure(element);
    } catch (Exception e) {
        String s = XMLUtils.prettyPrintDOM(node);
        String message = "Unable to configure the object from serialized XML data before its creation.\n"
                + "Object class: '" + objectClassName + "'\n" + "XML data:\n" + s;
        EngineException ee = new EngineException(message, e);
        throw ee;
    }

    try {
        long priority = new Long(element.getAttribute("priority")).longValue();
        databaseObject.priority = priority;

        Class<? extends DatabaseObject> databaseObjectClass = databaseObject.getClass();
        BeanInfo bi = CachedIntrospector.getBeanInfo(databaseObjectClass);
        PropertyDescriptor[] pds = bi.getPropertyDescriptors();

        NodeList childNodes = element.getChildNodes();
        int len = childNodes.getLength();

        PropertyDescriptor pd;
        Object propertyObjectValue;
        Class<?> propertyType;
        NamedNodeMap childAttributes;
        boolean maskValue = false;

        for (int i = 0; i < len; i++) {
            Node childNode = childNodes.item(i);
            if (childNode.getNodeType() != Node.ELEMENT_NODE) {
                continue;
            }

            Element childElement = (Element) childNode;

            childNodeName = childNode.getNodeName();

            Engine.logBeans.trace("Analyzing node '" + childNodeName + "'");

            if (childNodeName.equalsIgnoreCase("property")) {
                childAttributes = childNode.getAttributes();
                propertyName = childAttributes.getNamedItem("name").getNodeValue();
                Engine.logBeans.trace("  name = '" + propertyName + "'");
                pd = findPropertyDescriptor(pds, propertyName);
                if (pd == null) {
                    Engine.logBeans.warn(
                            "Unable to find the definition of property \"" + propertyName + "\"; skipping.");
                    continue;
                }
                propertyType = pd.getPropertyType();
                propertyObjectValue = XMLUtils
                        .readObjectFromXml((Element) XMLUtils.findChildNode(childNode, Node.ELEMENT_NODE));

                // Hides value in log trace if needed
                if ("false".equals(childElement.getAttribute("traceable"))) {
                    maskValue = true;
                }
                Engine.logBeans.trace("  value='"
                        + (maskValue ? Visibility.maskValue(propertyObjectValue) : propertyObjectValue) + "'");

                // Decrypts value if needed
                try {
                    if ("true".equals(childElement.getAttribute("ciphered"))) {
                        propertyObjectValue = decryptPropertyValue(propertyObjectValue);
                    }
                } catch (Exception e) {
                }

                propertyObjectValue = databaseObject.compileProperty(propertyType, propertyName,
                        propertyObjectValue);

                if (Enum.class.isAssignableFrom(propertyType)) {
                    propertyObjectValue = EnumUtils.valueOf(propertyType, propertyObjectValue);
                }

                propertyValue = propertyObjectValue.toString();

                Method setter = pd.getWriteMethod();
                Engine.logBeans.trace("  setter='" + setter.getName() + "'");
                Engine.logBeans.trace("  param type='" + propertyObjectValue.getClass().getName() + "'");
                Engine.logBeans.trace("  expected type='" + propertyType.getName() + "'");
                try {
                    setter.invoke(databaseObject, new Object[] { propertyObjectValue });
                } catch (InvocationTargetException e) {
                    Throwable targetException = e.getTargetException();
                    Engine.logBeans.warn("Unable to set the property '" + propertyName + "' for the object '"
                            + databaseObject.getName() + "' (" + objectClassName + "): ["
                            + targetException.getClass().getName() + "] " + targetException.getMessage());
                }

                if (Boolean.TRUE.equals(pd.getValue("nillable"))) {
                    Node nodeNull = childAttributes.getNamedItem("isNull");
                    String valNull = (nodeNull == null) ? "false" : nodeNull.getNodeValue();
                    Engine.logBeans.trace("  treats as null='" + valNull + "'");
                    try {
                        Method method = databaseObject.getClass().getMethod("setNullProperty",
                                new Class[] { String.class, Boolean.class });
                        method.invoke(databaseObject, new Object[] { propertyName, Boolean.valueOf(valNull) });
                    } catch (Exception ex) {
                        Engine.logBeans.warn("Unable to set the 'isNull' attribute for property '"
                                + propertyName + "' of '" + databaseObject.getName() + "' object");
                    }
                }
            }
        }
    } catch (Exception e) {
        String message = "Unable to set the object properties from the serialized XML data.\n"
                + "Object class: '" + objectClassName + "'\n" + "XML analyzed node: " + childNodeName + "\n"
                + "Property name: " + propertyName + "\n" + "Property value: " + propertyValue;
        EngineException ee = new EngineException(message, e);
        throw ee;
    }

    try {
        // Performs custom configuration
        databaseObject.configure(element);
    } catch (Exception e) {
        String s = XMLUtils.prettyPrintDOM(node);
        String message = "Unable to configure the object from serialized XML data after its creation.\n"
                + "Object class: '" + objectClassName + "'\n" + "XML data:\n" + s;
        EngineException ee = new EngineException(message, e);
        throw ee;
    }

    return databaseObject;
}

From source file:com.twinsoft.convertigo.beans.core.DatabaseObject.java

public Element toXml(Document document) throws EngineException {
    Element element = document.createElement(getDatabaseType().toLowerCase());

    element.setAttribute("classname", getClass().getName());
    if (exportOptions.contains(ExportOption.bIncludeVersion)) {
        element.setAttribute("version", com.twinsoft.convertigo.beans.Version.version);
    }// w  w w  . ja v  a2 s  .co m

    // Storing the database object priority
    element.setAttribute("priority", new Long(priority).toString());

    int len;
    PropertyDescriptor[] propertyDescriptors;
    PropertyDescriptor propertyDescriptor;
    Element propertyElement;

    try {
        BeanInfo bi = CachedIntrospector.getBeanInfo(getClass());
        propertyDescriptors = bi.getPropertyDescriptors();
        len = propertyDescriptors.length;
        if (exportOptions.contains(ExportOption.bIncludeDisplayName)) {
            element.setAttribute("displayName", bi.getBeanDescriptor().getDisplayName());
        }
    } catch (IntrospectionException e) {
        throw new EngineException("Couldn't introspect the bean \"" + getName() + "\"", e);
    }

    for (int i = 0; i < len; i++) {
        propertyDescriptor = propertyDescriptors[i];
        String name = propertyDescriptor.getName();
        String displayName = propertyDescriptor.getDisplayName();
        String shortDescription = propertyDescriptor.getShortDescription();

        Method getter = propertyDescriptor.getReadMethod();

        // Only analyze read propertyDescriptors.
        if (getter == null) {
            continue;
        }

        if (checkBlackListParentClass(propertyDescriptor)) {
            continue;
        }

        try {
            // Storing the database object bean properties
            Object uncompiledValue = getCompilablePropertySourceValue(name);
            Object compiledValue = null;
            Object cypheredValue = null;
            Object value = getter.invoke(this);

            if (uncompiledValue != null) {
                compiledValue = value;
                value = uncompiledValue;
            }

            // Only write non-null values
            if (value == null) {
                Engine.logBeans.warn("Attempting to store null property (\"" + name + "\"); skipping...");
                continue;
            }

            propertyElement = document.createElement("property");
            propertyElement.setAttribute("name", name);

            // Encrypts value if needed
            //if (isCipheredProperty(name) && !this.exportOptions.contains(ExportOption.bIncludeDisplayName)) {
            if (isCipheredProperty(name) && (this.exportOptions.contains(ExportOption.bHidePassword)
                    || !this.exportOptions.contains(ExportOption.bIncludeDisplayName))) {
                cypheredValue = encryptPropertyValue(value);
                if (!value.equals(cypheredValue)) {
                    value = cypheredValue;
                    propertyElement.setAttribute("ciphered", "true");
                }
            }

            // Stores the value
            Node node = null;
            if (exportOptions.contains(ExportOption.bIncludeCompiledValue)) {
                node = XMLUtils.writeObjectToXml(document, value, compiledValue);
            } else {
                node = XMLUtils.writeObjectToXml(document, value);
            }
            propertyElement.appendChild(node);

            // Add visibility for logs
            if (!isTraceableProperty(name)) {
                propertyElement.setAttribute("traceable", "false");
            }

            if (exportOptions.contains(ExportOption.bIncludeBlackListedElements)) {
                Object propertyDescriptorBlackListValue = propertyDescriptor
                        .getValue(MySimpleBeanInfo.BLACK_LIST_NAME);
                if (propertyDescriptorBlackListValue != null && (Boolean) propertyDescriptorBlackListValue) {
                    propertyElement.setAttribute("blackListed", "blackListed");
                }
            }
            if (exportOptions.contains(ExportOption.bIncludeDisplayName)) {
                propertyElement.setAttribute("displayName", displayName);
                propertyElement.setAttribute("isHidden", Boolean.toString(propertyDescriptor.isHidden()));
                propertyElement.setAttribute("isMasked",
                        isMaskedProperty(Visibility.Platform, name) ? "true" : "false");
                propertyElement.setAttribute("isExpert", Boolean.toString(propertyDescriptor.isExpert()));
            }
            if (exportOptions.contains(ExportOption.bIncludeShortDescription)) {
                propertyElement.setAttribute("shortDescription", shortDescription);
            }

            if (exportOptions.contains(ExportOption.bIncludeEditorClass)) {
                Class<?> pec = propertyDescriptor.getPropertyEditorClass();
                String message = "";
                if (pec != null) {
                    message = propertyDescriptor.getPropertyEditorClass().toString().replaceFirst("(.)*\\.",
                            "");
                } else {
                    message = "null";
                }
                if (this instanceof ITagsProperty || (pec != null && Enum.class.isAssignableFrom(pec))) {
                    String[] sResults = null;
                    try {
                        if (this instanceof ITagsProperty) {
                            sResults = ((ITagsProperty) this).getTagsForProperty(name);
                        } else {
                            sResults = EnumUtils.toNames(pec);
                        }
                    } catch (Exception ex) {
                        sResults = new String[0];
                    }

                    if (sResults != null) {
                        if (sResults.length > 0) {
                            Element possibleValues = document.createElement("possibleValues");
                            Element possibleValue = null;
                            for (int j = 0; j < sResults.length; j++) {
                                possibleValue = document.createElement("value");
                                possibleValue.setTextContent(sResults[j]);
                                possibleValues.appendChild(possibleValue);
                            }
                            propertyElement.appendChild(possibleValues);
                        }
                    }
                }
                propertyElement.setAttribute("editorClass", message);
            }

            element.appendChild(propertyElement);

            if (Boolean.TRUE.equals(propertyDescriptor.getValue("nillable"))) {
                try {
                    Method method = this.getClass().getMethod("isNullProperty", new Class[] { String.class });
                    Object isNull = method.invoke(this, new Object[] { name });
                    propertyElement.setAttribute("isNull", isNull.toString());
                } catch (Exception ex) {
                    Engine.logBeans.error(
                            "[Serialization] Skipping 'isNull' attribute for property \"" + name + "\".", ex);
                }
            }
        } catch (Exception e) {
            Engine.logBeans.error("[Serialization] Skipping property \"" + name + "\".", e);
        }
    }

    return element;
}

From source file:net.sourceforge.vulcan.web.struts.forms.PluginConfigForm.java

@SuppressWarnings("unchecked")
private String getTypeAndPrepare(String propertyName, PropertyDescriptor pd) {
    final Class<?> c = pd.getPropertyType();
    final ConfigChoice choicesType = (ConfigChoice) pd.getValue(PluginConfigDto.ATTR_CHOICE_TYPE);

    if (choicesType != null) {
        switch (choicesType) {
        case PROJECTS:
            choices.put(propertyName, availableProjects);
            break;
        case INLINE:
            choices.put(propertyName, (List<String>) pd.getValue(PluginConfigDto.ATTR_AVAILABLE_CHOICES));
        }/*  ww w  .ja va 2s . co m*/
        if (c.isArray()) {
            return "choice-array";
        }
        return "enum";
    }

    final Widget widget = (Widget) pd.getValue(PluginConfigDto.ATTR_WIDGET_TYPE);

    if (Widget.PASSWORD.equals(widget)) {
        hidePassword(propertyName);
    }

    if (c.isArray()) {
        final Class<?> componentType = c.getComponentType();
        if (isPrimitive(componentType)) {
            return "primitive-array";
        } else if (Enum.class.isAssignableFrom(componentType)) {
            populateEnumChoices(propertyName, componentType);
            return "choice-array";
        }
        return "object-array";
    } else if (isBoolean(c)) {
        return "boolean";
    } else if (isPrimitive(c)) {
        if (widget != null) {
            return widget.name().toLowerCase();
        }
        return "primitive";
    } else if (Enum.class.isAssignableFrom(c)) {
        populateEnumChoices(propertyName, c);
        if (widget != null) {
            return widget.name().toLowerCase();
        }
        return "enum";
    }
    return "object";
}

From source file:org.apache.jmeter.testbeans.gui.ComboStringEditor.java

ComboStringEditor(PropertyDescriptor descriptor) {
    this((String[]) descriptor.getValue(GenericTestBeanCustomizer.TAGS),
            GenericTestBeanCustomizer.notExpression(descriptor), GenericTestBeanCustomizer.notNull(descriptor),
            (ResourceBundle) descriptor.getValue(GenericTestBeanCustomizer.RESOURCE_BUNDLE));
}

From source file:org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.java

/**
 * Create a customizer for a given test bean type.
 *
 * @param testBeanClass// w  w  w.j  av a2  s.c  om
 *            a subclass of TestBean
 * @see org.apache.jmeter.testbeans.TestBean
 */
GenericTestBeanCustomizer(BeanInfo beanInfo) {
    super();

    this.beanInfo = beanInfo;

    // Get and sort the property descriptors:
    descriptors = beanInfo.getPropertyDescriptors();
    Arrays.sort(descriptors, new PropertyComparator(beanInfo));

    // Obtain the propertyEditors:
    editors = new PropertyEditor[descriptors.length];
    int scriptLanguageIndex = 0;
    int textAreaEditorIndex = 0;
    for (int i = 0; i < descriptors.length; i++) { // Index is also used for accessing editors array
        PropertyDescriptor descriptor = descriptors[i];
        String name = descriptor.getName();

        // Don't get editors for hidden or non-read-write properties:
        if (TestBeanHelper.isDescriptorIgnored(descriptor)) {
            log.debug("Skipping editor for property " + name);
            editors[i] = null;
            continue;
        }

        PropertyEditor propertyEditor;
        Object guiType = descriptor.getValue(GUITYPE);
        if (guiType instanceof TypeEditor) {
            propertyEditor = ((TypeEditor) guiType).getInstance(descriptor);
        } else if (guiType instanceof Class && Enum.class.isAssignableFrom((Class<?>) guiType)) {
            @SuppressWarnings("unchecked") // we check the class type above
            final Class<? extends Enum<?>> enumClass = (Class<? extends Enum<?>>) guiType;
            propertyEditor = new EnumEditor(descriptor, enumClass,
                    (ResourceBundle) descriptor.getValue(GenericTestBeanCustomizer.RESOURCE_BUNDLE));
        } else {
            Class<?> editorClass = descriptor.getPropertyEditorClass();
            if (log.isDebugEnabled()) {
                log.debug("Property " + name + " has editor class " + editorClass);
            }

            if (editorClass != null) {
                try {
                    propertyEditor = (PropertyEditor) editorClass.newInstance();
                } catch (InstantiationException | IllegalAccessException e) {
                    log.error("Can't create property editor.", e);
                    throw new Error(e.toString());
                }
            } else {
                Class<?> c = descriptor.getPropertyType();
                propertyEditor = PropertyEditorManager.findEditor(c);
            }
        }

        if (propertyEditor == null) {
            log.warn("No editor for property: " + name + " type: " + descriptor.getPropertyType() + " in bean: "
                    + beanInfo.getBeanDescriptor().getDisplayName());
            editors[i] = null;
            continue;
        }

        if (log.isDebugEnabled()) {
            log.debug("Property " + name + " has property editor " + propertyEditor);
        }

        validateAttributes(descriptor, propertyEditor);

        if (!propertyEditor.supportsCustomEditor()) {
            propertyEditor = createWrapperEditor(propertyEditor, descriptor);

            if (log.isDebugEnabled()) {
                log.debug("Editor for property " + name + " is wrapped in " + propertyEditor);
            }
        }
        if (propertyEditor instanceof TestBeanPropertyEditor) {
            ((TestBeanPropertyEditor) propertyEditor).setDescriptor(descriptor);
        }

        if (propertyEditor instanceof TextAreaEditor) {
            textAreaEditorIndex = i;
        }
        if (propertyEditor.getCustomEditor() instanceof JScrollPane) {
            scrollerCount++;
        }

        editors[i] = propertyEditor;

        // Initialize the editor with the provided default value or null:
        setEditorValue(i, descriptor.getValue(DEFAULT));

        if (name.equals("scriptLanguage")) {
            scriptLanguageIndex = i;
        }

    }
    // In case of BSF and JSR elements i want to add textAreaEditor as a listener to scriptLanguage ComboBox.
    String beanName = this.beanInfo.getBeanDescriptor().getName();
    if (beanName.startsWith("BSF") || beanName.startsWith("JSR223")) { // $NON-NLS-1$ $NON-NLS-2$
        WrapperEditor we = (WrapperEditor) editors[scriptLanguageIndex];
        TextAreaEditor tae = (TextAreaEditor) editors[textAreaEditorIndex];
        we.addChangeListener(tae);
    }

    // Obtain message formats:
    propertyFieldLabelMessage = new MessageFormat(JMeterUtils.getResString("property_as_field_label")); //$NON-NLS-1$
    propertyToolTipMessage = new MessageFormat(JMeterUtils.getResString("property_tool_tip")); //$NON-NLS-1$

    // Initialize the GUI:
    init();
}

From source file:org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.java

/**
 * Validate the descriptor attributes./*from  w ww  .  j a  v  a2 s  . c om*/
 * 
 * @param pd the descriptor
 * @param pe the propertyEditor
 */
private static void validateAttributes(PropertyDescriptor pd, PropertyEditor pe) {
    final Object deflt = pd.getValue(DEFAULT);
    if (deflt == null) {
        if (notNull(pd)) {
            log.warn(getDetails(pd) + " requires a value but does not provide a default.");
        }
        if (noSaveDefault(pd)) {
            log.warn(getDetails(pd) + " specifies DEFAULT_NO_SAVE but does not provide a default.");
        }
    } else {
        final Class<?> defltClass = deflt.getClass(); // the DEFAULT class
        // Convert int to Integer etc:
        final Class<?> propClass = ClassUtils.primitiveToWrapper(pd.getPropertyType());
        if (!propClass.isAssignableFrom(defltClass)) {
            log.warn(getDetails(pd) + " has a DEFAULT of class " + defltClass.getCanonicalName());
        }
    }
    if (notOther(pd) && pd.getValue(TAGS) == null && pe.getTags() == null) {
        log.warn(getDetails(pd) + " does not have tags but other values are not allowed.");
    }
    if (!notNull(pd)) {
        Class<?> propertyType = pd.getPropertyType();
        if (propertyType.isPrimitive()) {
            log.warn(getDetails(pd) + " allows null but is a primitive type");
        }
    }
    if (!pd.attributeNames().hasMoreElements()) {
        log.warn(getDetails(pd) + " does not appear to have been configured");
    }
}

From source file:org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.java

/**
 * Find the default typeEditor and a suitable guiEditor for the given
 * property descriptor, and combine them in a WrapperEditor.
 *
 * @param typeEditor/*from ww w  .jav  a2  s.com*/
 * @param descriptor
 * @return the wrapper editor
 */
private WrapperEditor createWrapperEditor(PropertyEditor typeEditor, PropertyDescriptor descriptor) {
    String[] editorTags = typeEditor.getTags();
    String[] additionalTags = (String[]) descriptor.getValue(TAGS);
    String[] tags = null;
    if (editorTags == null) {
        tags = additionalTags;
    } else if (additionalTags == null) {
        tags = editorTags;
    } else {
        tags = new String[editorTags.length + additionalTags.length];
        int j = 0;
        for (String editorTag : editorTags) {
            tags[j++] = editorTag;
        }
        for (String additionalTag : additionalTags) {
            tags[j++] = additionalTag;
        }
    }

    boolean notNull = notNull(descriptor);
    boolean notExpression = notExpression(descriptor);
    boolean notOther = notOther(descriptor);

    PropertyEditor guiEditor;
    if (notNull && tags == null) {
        guiEditor = new FieldStringEditor();
    } else {
        guiEditor = new ComboStringEditor(tags, notExpression && notOther, notNull,
                (ResourceBundle) descriptor.getValue(GenericTestBeanCustomizer.RESOURCE_BUNDLE));
    }

    WrapperEditor wrapper = new WrapperEditor(typeEditor, guiEditor, !notNull, // acceptsNull
            !notExpression, // acceptsExpressions
            !notOther, // acceptsOther
            descriptor.getValue(DEFAULT));

    return wrapper;
}

From source file:org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.java

/**
 * Returns true if the property disallows constant values different from the provided tags.
 * /* w  ww  . ja v a 2  s. c  o  m*/
 * @param descriptor the property descriptor
 * @return true if the attribute {@link #NOT_OTHER} is defined and equal to Boolean.TRUE;
 *  otherwise the default is false
 */
static boolean notOther(PropertyDescriptor descriptor) {
    boolean notOther = Boolean.TRUE.equals(descriptor.getValue(NOT_OTHER));
    return notOther;
}