|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pmd.AbstractPropertySource
public abstract class AbstractPropertySource
Base class for objects which can be configured through properties. Rules and Reports are such objects.
Field Summary | |
---|---|
protected List<PropertyDescriptor<?>> |
propertyDescriptors
The list of known properties that can be configured. |
protected Map<PropertyDescriptor<?>,Object> |
propertyValuesByDescriptor
The values for each property. |
Constructor Summary | |
---|---|
AbstractPropertySource()
|
Method Summary | ||
---|---|---|
protected List<PropertyDescriptor<?>> |
copyPropertyDescriptors()
Creates a copied list of the property descriptors and returns it. |
|
protected Map<PropertyDescriptor<?>,Object> |
copyPropertyValues()
Creates a copied map of the values of the properties and returns it. |
|
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()
Gets the name of the property source. |
|
Map<PropertyDescriptor<?>,Object> |
getPropertiesByPropertyDescriptor()
Returns all the current property values for the receiver or an immutable empty map if none are specified. |
|
|
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. |
|
|
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 |
---|
protected List<PropertyDescriptor<?>> propertyDescriptors
protected Map<PropertyDescriptor<?>,Object> propertyValuesByDescriptor
Constructor Detail |
---|
public AbstractPropertySource()
Method Detail |
---|
protected List<PropertyDescriptor<?>> copyPropertyDescriptors()
protected Map<PropertyDescriptor<?>,Object> copyPropertyValues()
public Set<PropertyDescriptor<?>> ignoredProperties()
ignoredProperties
in interface PropertySource
public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor)
definePropertyDescriptor
in interface PropertySource
propertyDescriptor
- The property descriptor.public abstract String getName()
public PropertyDescriptor<?> getPropertyDescriptor(String name)
getPropertyDescriptor
in interface PropertySource
name
- The name of the property.
null
if there is no such property defined.public boolean hasDescriptor(PropertyDescriptor<?> descriptor)
hasDescriptor
in interface PropertySource
descriptor
- The PropertyDescriptor for which to check.
true
if the descriptor is present,
false
otherwise.public List<PropertyDescriptor<?>> getPropertyDescriptors()
getPropertyDescriptors
in interface PropertySource
public <T> T getProperty(PropertyDescriptor<T> propertyDescriptor)
getProperty
in interface PropertySource
T
- The underlying type of the property descriptor.propertyDescriptor
- The property descriptor.
public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor, T value)
setProperty
in interface PropertySource
T
- The underlying type of the property descriptor.propertyDescriptor
- The property descriptor.value
- The value to set.public Map<PropertyDescriptor<?>,Object> getPropertiesByPropertyDescriptor()
getPropertiesByPropertyDescriptor
in interface PropertySource
public boolean usesDefaultValues()
usesDefaultValues
in interface PropertySource
true
if the properties all have default
values, false
otherwise.public void useDefaultValueFor(PropertyDescriptor<?> desc)
useDefaultValueFor
in interface PropertySource
desc
- the property to clear outpublic String dysfunctionReason()
dysfunctionReason
in interface PropertySource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |