}
@Override
public void process(final ProcessMethodContext processMethodContext) {
final Method method = processMethodContext.getMethod();
FacetedMethod holder = processMethodContext.getFacetHolder();
final PropertyOrCollectionAccessorFacet getterFacet = holder.getFacet(PropertyOrCollectionAccessorFacet.class);
if(getterFacet == null) {
return;
}
//
// Set up PropertyInteractionFacet, which will act as the hiding/disabling/validating advisor
//
final PropertyInteraction propertyInteraction = Annotations.getAnnotation(method, PropertyInteraction.class);
final Class<? extends PropertyInteractionEvent<?, ?>> propertyInteractionEventType;
final PropertyInteractionFacetAbstract propertyInteractionFacet;
if(propertyInteraction != null) {
propertyInteractionEventType = propertyInteraction.value();
propertyInteractionFacet = new PropertyInteractionFacetAnnotation(
propertyInteractionEventType, getterFacet, holder, servicesInjector, getSpecificationLoader());
} else {
propertyInteractionEventType = PropertyInteractionEvent.Default.class;
propertyInteractionFacet = new PropertyInteractionFacetDefault(
propertyInteractionEventType, getterFacet, holder, servicesInjector, getSpecificationLoader());
}
FacetUtil.addFacet(propertyInteractionFacet);
//
// if the property is mutable, then replace the existing setter and clear facets with equivalents that
// also post to the event bus.
//
// here we support the deprecated annotations
//
final PostsPropertyChangedEvent postsPropertyChangedEvent = Annotations.getAnnotation(method, PostsPropertyChangedEvent.class);
final PropertySetterFacet setterFacet = holder.getFacet(PropertySetterFacet.class);
if(setterFacet != null) {
// the current setter facet will end up as the underlying facet
final PropertySetterFacetForInteractionAbstract replacementFacet;
if(propertyInteraction != null) {
replacementFacet = new PropertySetterFacetForPropertyInteractionAnnotation(
propertyInteractionEventType, getterFacet, setterFacet, propertyInteractionFacet, holder, servicesInjector);
} else if(postsPropertyChangedEvent != null) {
replacementFacet = new PropertySetterFacetForPostsPropertyChangedEventAnnotation(
postsPropertyChangedEvent.value(), getterFacet, setterFacet, propertyInteractionFacet, holder, servicesInjector);
} else {
replacementFacet = new PropertySetterFacetForPropertyInteractionDefault(
PropertyInteractionEvent.Default.class, getterFacet, setterFacet, propertyInteractionFacet, holder, servicesInjector);
}
FacetUtil.addFacet(replacementFacet);
}
final PropertyClearFacet clearFacet = holder.getFacet(PropertyClearFacet.class);
if(clearFacet != null) {
// the current clear facet will end up as the underlying facet
final PropertyClearFacetForInteractionAbstract replacementFacet;
if(propertyInteraction != null) {
replacementFacet = new PropertyClearFacetForPropertyInteractionAnnotation(