org.apache.felix.scrplugin.helper
Class PropertyHandler

java.lang.Object
  extended by org.apache.felix.scrplugin.helper.PropertyHandler

public class PropertyHandler
extends Object

Utility class for handling the properties.


Nested Class Summary
protected static class PropertyHandler.PropertyDescription
           
 
Constructor Summary
PropertyHandler(Component c, OCD o)
           
 
Method Summary
protected  String getPropertyName(JavaTag tag, JavaField field)
          Return the name of the property.
protected  String[] getPropertyValueRef(JavaTag tag, Property prop, String valueRef)
           
protected  JavaField getReferencedField(JavaTag tag, String ref)
           
 void handleField(JavaField javaField, boolean isInspectedClass)
           
 void processProperties(Map<String,String> globalProperties, IssueLog iLog)
          Process all found properties for the component.
protected  void processProperty(JavaTag tag, String name, JavaField javaField, IssueLog iLog)
          Process a property.
protected  void setPropertyValueRef(JavaTag tag, Property property, String valueRef)
           
 void testProperty(JavaTag property, JavaField field, boolean isInspectedClass)
          Test if there is already a property with the same name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyHandler

public PropertyHandler(Component c,
                       OCD o)
Method Detail

processProperty

protected void processProperty(JavaTag tag,
                               String name,
                               JavaField javaField,
                               IssueLog iLog)
                        throws SCRDescriptorException
Process a property.

Parameters:
tag - The property tag.
name - The name of the property.
javaField - The corresponding java field or null.
Throws:
SCRDescriptorException

getPropertyName

protected String getPropertyName(JavaTag tag,
                                 JavaField field)
                          throws SCRDescriptorException
Return the name of the property. The name of the property is derived by:
  1. looking at the attribute Constants.PROPERTY_NAME
  2. looking at the attribute Constants.PROPERTY_NAME_REF
  3. if the property is specified at a filed and the field is of type string the init value is used.

Parameters:
property - The property tag.
field - The corresponding field if the property is a tag of a field.
Returns:
The name of the property or the defaultName
Throws:
SCRDescriptorException

setPropertyValueRef

protected void setPropertyValueRef(JavaTag tag,
                                   Property property,
                                   String valueRef)
                            throws SCRDescriptorException
Throws:
SCRDescriptorException

getReferencedField

protected JavaField getReferencedField(JavaTag tag,
                                       String ref)
                                throws SCRDescriptorException
Throws:
SCRDescriptorException

getPropertyValueRef

protected String[] getPropertyValueRef(JavaTag tag,
                                       Property prop,
                                       String valueRef)
                                throws SCRDescriptorException
Throws:
SCRDescriptorException

testProperty

public void testProperty(JavaTag property,
                         JavaField field,
                         boolean isInspectedClass)
                  throws SCRDescriptorException
Test if there is already a property with the same name.

Parameters:
property - The tag.
field -
isInspectedClass -
Throws:
SCRDescriptorException

handleField

public void handleField(JavaField javaField,
                        boolean isInspectedClass)
                 throws SCRDescriptorException
Throws:
SCRDescriptorException

processProperties

public void processProperties(Map<String,String> globalProperties,
                              IssueLog iLog)
                       throws SCRDescriptorException
Process all found properties for the component.

Parameters:
globalProperties - Global properties are set on all components.
iLog - The issue log.
Throws:
SCRDescriptorException


Copyright © 2011 Apache Software Foundation. All Rights Reserved.