Search in sources :

Example 11 with Association

use of org.qi4j.api.association.Association in project qi4j-sdk by Qi4j.

the class Qi4jPropertyAccessor method getProperty.

@Override
public final Object getProperty(Map aContext, Object aTarget, Object aPropertyName) throws OgnlException {
    String fieldName = aPropertyName.toString();
    Object qi4jField = getQi4jField(aContext, aTarget, fieldName);
    if (qi4jField != null) {
        Class memberClass = qi4jField.getClass();
        if (Property.class.isAssignableFrom(memberClass)) {
            Property property = (Property) qi4jField;
            return property.get();
        } else if (Association.class.isAssignableFrom(memberClass)) {
            Association association = (Association) qi4jField;
            return association.get();
        } else if (ManyAssociation.class.isAssignableFrom(memberClass)) {
            return qi4jField;
        }
    }
    return super.getProperty(aContext, aTarget, fieldName);
}
Also used : ManyAssociation(org.qi4j.api.association.ManyAssociation) Association(org.qi4j.api.association.Association) Property(org.qi4j.api.property.Property)

Aggregations

Association (org.qi4j.api.association.Association)11 ManyAssociation (org.qi4j.api.association.ManyAssociation)9 AssociationDescriptor (org.qi4j.api.association.AssociationDescriptor)3 Property (org.qi4j.api.property.Property)3 AssociationModel (org.qi4j.runtime.association.AssociationModel)3 ManyAssociationModel (org.qi4j.runtime.association.ManyAssociationModel)3 Annotation (java.lang.annotation.Annotation)2 AccessibleObject (java.lang.reflect.AccessibleObject)2 Member (java.lang.reflect.Member)2 AssociationStateDescriptor (org.qi4j.api.association.AssociationStateDescriptor)2 MetaInfo (org.qi4j.api.common.MetaInfo)2 Optional (org.qi4j.api.common.Optional)2 ValueConstraintsInstance (org.qi4j.runtime.composite.ValueConstraintsInstance)2 ValueConstraintsModel (org.qi4j.runtime.composite.ValueConstraintsModel)2 Method (java.lang.reflect.Method)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 QName (javax.xml.namespace.QName)1 AegisType (org.apache.cxf.aegis.type.AegisType)1 MessageWriter (org.apache.cxf.aegis.xml.MessageWriter)1