org.teiid.rhq.plugin.adapter.api
Interface PropertyAdapter<P extends org.rhq.core.domain.configuration.Property,D extends org.rhq.core.domain.configuration.definition.PropertyDefinition>

All Known Implementing Classes:
AbstractPropertyListAdapter, AbstractPropertyMapAdapter, AbstractPropertyMapToCompositeValueAdapter, AbstractPropertySimpleAdapter, PropertyListToCollectionValueAdapter, PropertyMapToCompositeValueSupportAdapter, PropertyMapToGenericValueAdapter, PropertyMapToMapCompositeValueSupportAdapter, PropertyMapToPropertiesValueAdapter, PropertyMapToTableValueAdapter, PropertySimpleToEnumValueAdapter, PropertySimpleToSimpleValueAdapter

public interface PropertyAdapter<P extends org.rhq.core.domain.configuration.Property,D extends org.rhq.core.domain.configuration.definition.PropertyDefinition>

An adapter that can convert back and forth between a specific type of MetaValue and a specific type of Property.


Method Summary
 org.jboss.metatype.api.values.MetaValue convertToMetaValue(P property, D propertyDefinition, org.jboss.metatype.api.types.MetaType metaType)
          Given a Property and its PropertyDefinition, create and return a corresponding MetaValue with the specified MetaType.
 P convertToProperty(org.jboss.metatype.api.values.MetaValue metaValue, D propertyDefinition)
          Given a MetaValue, create and return a corresponding Property with the specified PropertyDefinition.
 void populateMetaValueFromProperty(P property, org.jboss.metatype.api.values.MetaValue metaValue, D propertyDefinition)
          Given a Property and its PropertyDefinition, as well as a MetaValue, populate that MetaValue so it corresponds to the Property.
 void populatePropertyFromMetaValue(P property, org.jboss.metatype.api.values.MetaValue metaValue, D propertyDefinition)
          Given a Property and its PropertyDefinition, as well as a MetaValue, populate the Property so it corresponds to the MetaValue.
 

Method Detail

populateMetaValueFromProperty

void populateMetaValueFromProperty(P property,
                                   org.jboss.metatype.api.values.MetaValue metaValue,
                                   D propertyDefinition)
Given a Property and its PropertyDefinition, as well as a MetaValue, populate that MetaValue so it corresponds to the Property. If the Property is a list or a map, all descendant Property's should be added as descendants of the MetaValue.

Parameters:
property - the property to be copied
metaValue - the MetaValue to be populated; should not be null
propertyDefinition - the property's definition

convertToMetaValue

org.jboss.metatype.api.values.MetaValue convertToMetaValue(P property,
                                                           D propertyDefinition,
                                                           org.jboss.metatype.api.types.MetaType metaType)
Given a Property and its PropertyDefinition, create and return a corresponding MetaValue with the specified MetaType. If the Property is a list or a map, all descendant Property's should be represented as descendants of the returned MetaValue. Generally this method can simply create an empty MetaValue object and then delegate the population of the guts of the object to populateMetaValueFromProperty(Property, MetaValue, PropertyDefinition).

Parameters:
property - the property to be converted
propertyDefinition - the property's definition
metaType - the type of MetaValue that should be created and returned
Returns:
the MetaValue representation of the given Property

populatePropertyFromMetaValue

void populatePropertyFromMetaValue(P property,
                                   org.jboss.metatype.api.values.MetaValue metaValue,
                                   D propertyDefinition)
Given a Property and its PropertyDefinition, as well as a MetaValue, populate the Property so it corresponds to the MetaValue. If the MetaValue is a from of list or map, all descendant MetaValue's should be added as descendants of the Property.

Parameters:
property - the property to be populated; should not be null
metaValue - the MetaValue to be copied
propertyDefinition - the property's definition

convertToProperty

P convertToProperty(org.jboss.metatype.api.values.MetaValue metaValue,
                    D propertyDefinition)
Given a MetaValue, create and return a corresponding Property with the specified PropertyDefinition. If the MetaValue is a form of list or map, all descendant MetaValue's should be represented as descendants of the returned Property. Generally this method can simply create an empty Property object and then delegate the population of the guts of the object to populatePropertyFromMetaValue(Property, MetaValue, PropertyDefinition).

Parameters:
metaValue - the metaValue to be converted
propertyDefinition - the definition of the property to be created and returned
Returns:
the Property representation of the given MetaValue


Copyright © 2011. All Rights Reserved.