net.sourceforge.pmd
Class AbstractPropertySource

java.lang.Object
  extended by net.sourceforge.pmd.AbstractPropertySource
All Implemented Interfaces:
PropertySource
Direct Known Subclasses:
AbstractRenderer, AbstractRule

public abstract class AbstractPropertySource
extends Object
implements PropertySource

Author:
Brian Remedios

Field Summary
protected  List<PropertyDescriptor<?>> propertyDescriptors
           
protected  Map<PropertyDescriptor<?>,Object> propertyValuesByDescriptor
           
 
Constructor Summary
AbstractPropertySource()
           
 
Method Summary
protected  List<PropertyDescriptor<?>> copyPropertyDescriptors()
           
protected  Map<PropertyDescriptor<?>,Object> copyPropertyValues()
           
 void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
          Define a new property via a PropertyDescriptor.
 String dysfunctionReason()
          Returns a description of why the receiver may be dysfunctional.
abstract  String getName()
           
 Map<PropertyDescriptor<?>,Object> getPropertiesByPropertyDescriptor()
          Returns all the current property values for the receiver or an immutable empty map if none are specified.
<T> T
getProperty(PropertyDescriptor<T> propertyDescriptor)
          Get the typed value for the given property.
 PropertyDescriptor<?> getPropertyDescriptor(String name)
          Get the PropertyDescriptor for the given property name.
 List<PropertyDescriptor<?>> getPropertyDescriptors()
          Get the PropertyDescriptors for all defined properties.
 boolean hasDescriptor(PropertyDescriptor<?> descriptor)
          Returns whether this Rule has the specified PropertyDescriptor.
 Set<PropertyDescriptor<?>> ignoredProperties()
          Return the properties that are effectively ignored due to the configuration of the rule and values held by other properties.
<T> void
setProperty(PropertyDescriptor<T> propertyDescriptor, T value)
          Set the property value specified (will be type-checked)
 void useDefaultValueFor(PropertyDescriptor<?> desc)
          Clears out any user-specified value for the property allowing it to use the default value in the descriptor.
 boolean usesDefaultValues()
          Returns whether this Rule uses default values for properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyDescriptors

protected List<PropertyDescriptor<?>> propertyDescriptors

propertyValuesByDescriptor

protected Map<PropertyDescriptor<?>,Object> propertyValuesByDescriptor
Constructor Detail

AbstractPropertySource

public AbstractPropertySource()
Method Detail

copyPropertyDescriptors

protected List<PropertyDescriptor<?>> copyPropertyDescriptors()

copyPropertyValues

protected Map<PropertyDescriptor<?>,Object> copyPropertyValues()

ignoredProperties

public Set<PropertyDescriptor<?>> ignoredProperties()
Description copied from interface: PropertySource
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
See Also:
PropertySource.ignoredProperties()

definePropertyDescriptor

public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
Description copied from interface: PropertySource
Define a new property via a PropertyDescriptor.

Specified by:
definePropertyDescriptor in interface PropertySource
Parameters:
propertyDescriptor - The property descriptor.
See Also:
PropertySource.definePropertyDescriptor(PropertyDescriptor)

getName

public abstract String getName()

getPropertyDescriptor

public PropertyDescriptor<?> getPropertyDescriptor(String name)
Description copied from interface: PropertySource
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.
See Also:
PropertySource.getPropertyDescriptor(String)

hasDescriptor

public boolean hasDescriptor(PropertyDescriptor<?> descriptor)
Description copied from interface: PropertySource
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.
See Also:
PropertySource.hasDescriptor(PropertyDescriptor)

getPropertyDescriptors

public List<PropertyDescriptor<?>> getPropertyDescriptors()
Description copied from interface: PropertySource
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.
See Also:
PropertySource.getPropertyDescriptors()

getProperty

public <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)
Description copied from interface: PropertySource
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.
See Also:
PropertySource.getProperty(PropertyDescriptor)

setProperty

public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor,
                            T value)
Description copied from interface: PropertySource
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.
See Also:
PropertySource.setProperty(PropertyDescriptor, Object)

getPropertiesByPropertyDescriptor

public Map<PropertyDescriptor<?>,Object> getPropertiesByPropertyDescriptor()
Description copied from interface: PropertySource
Returns all the current property values for the receiver or an immutable empty map if none are specified.

Specified by:
getPropertiesByPropertyDescriptor in interface PropertySource
See Also:
PropertySource.getPropertiesByPropertyDescriptor()

usesDefaultValues

public boolean usesDefaultValues()
Description copied from interface: PropertySource
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.
See Also:
PropertySource.usesDefaultValues()

useDefaultValueFor

public void useDefaultValueFor(PropertyDescriptor<?> desc)
Description copied from interface: PropertySource
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

dysfunctionReason

public String dysfunctionReason()
Description copied from interface: PropertySource
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
See Also:
PropertySource.dysfunctionReason()


Copyright © 2002-2012 InfoEther. All Rights Reserved.