JavaScript is disabled on your browser.
net.sourceforge.pmd

Class AbstractPropertySource

  • All Implemented Interfaces:
    PropertySource
    Direct Known Subclasses:
    AbstractRenderer, AbstractRule


    public abstract class AbstractPropertySource
    extends Object
    implements PropertySource 
    Base class for objects which can be configured through properties. Rules and Reports are such objects.
    Author:
    Brian Remedios
    • Field Detail

      • propertyDescriptors

        protected List<PropertyDescriptor<?>> propertyDescriptors
        The list of known properties that can be configured.
    • Constructor Detail

      • AbstractPropertySource

        public AbstractPropertySource()
        Creates a new empty property source.
    • Method Detail

      • copyPropertyDescriptors

        protected List<PropertyDescriptor<?>> copyPropertyDescriptors()
        Creates a copied list of the property descriptors and returns it.
        Returns:
        a copy of the property descriptors.
      • copyPropertyValues

        protected Map<PropertyDescriptor<?>,Object> copyPropertyValues()
        Creates a copied map of the values of the properties and returns it.
        Returns:
        a copy of the values
      • ignoredProperties

        public Set<PropertyDescriptor<?>> ignoredProperties()
        Return the properties that are effectively ignored due to the configuration of the rule and values held by other properties. This can be used to disable corresponding widgets in a UI.
        Specified by:
        ignoredProperties in interface PropertySource
        Returns:
        the properties that are ignored
      • getName

        public abstract String getName()
        Gets the name of the property source. This is e.g. the rule name or the report name.
        Returns:
        the name
      • getPropertyDescriptor

        public PropertyDescriptor<?> getPropertyDescriptor(String name)
        Get the PropertyDescriptor for the given property name.
        Specified by:
        getPropertyDescriptor in interface PropertySource
        Parameters:
        name - The name of the property.
        Returns:
        The PropertyDescriptor for the named property, null if there is no such property defined.
      • hasDescriptor

        public boolean hasDescriptor(PropertyDescriptor<?> descriptor)
        Returns whether this Rule has the specified PropertyDescriptor.
        Specified by:
        hasDescriptor in interface PropertySource
        Parameters:
        descriptor - The PropertyDescriptor for which to check.
        Returns:
        boolean true if the descriptor is present, false otherwise.
      • getPropertyDescriptors

        public List<PropertyDescriptor<?>> getPropertyDescriptors()
        Get the PropertyDescriptors for all defined properties. The properties are returned sorted by UI order.
        Specified by:
        getPropertyDescriptors in interface PropertySource
        Returns:
        The PropertyDescriptors in UI order.
      • getProperty

        public <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)
        Get the typed value for the given property.
        Specified by:
        getProperty in interface PropertySource
        Type Parameters:
        T - The underlying type of the property descriptor.
        Parameters:
        propertyDescriptor - The property descriptor.
        Returns:
        The property value.
      • setProperty

        public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor,
         T value)
        Set the property value specified (will be type-checked)
        Specified by:
        setProperty in interface PropertySource
        Type Parameters:
        T - The underlying type of the property descriptor.
        Parameters:
        propertyDescriptor - The property descriptor.
        value - The value to set.
      • usesDefaultValues

        public boolean usesDefaultValues()
        Returns whether this Rule uses default values for properties.
        Specified by:
        usesDefaultValues in interface PropertySource
        Returns:
        boolean true if the properties all have default values, false otherwise.
      • useDefaultValueFor

        public void useDefaultValueFor(PropertyDescriptor<?> desc)
        Clears out any user-specified value for the property allowing it to use the default value in the descriptor.
        Specified by:
        useDefaultValueFor in interface PropertySource
        Parameters:
        desc - the property to clear out
      • dysfunctionReason

        public String dysfunctionReason()
        Returns a description of why the receiver may be dysfunctional. Usually due to missing property values or some kind of conflict between values. Returns null if the receiver is ok.
        Specified by:
        dysfunctionReason in interface PropertySource
        Returns:
        String

Copyright © 2002-2014 InfoEther. All Rights Reserved.

AltStyle によって変換されたページ (->オリジナル) /