@Override
public Facet decorate(final Facet facet, final FacetHolder requiredHolder) {
if (!(requiredHolder instanceof IdentifiedHolder)) {
return null;
}
final IdentifiedHolder identifiedHolder = (IdentifiedHolder) requiredHolder;
final Class<? extends Facet> facetType = facet.facetType();
if (facetType == PropertySetterFacet.class) {
final PropertySetterFacet propertySetterFacet = (PropertySetterFacet) facet;
final PropertySetterFacetWrapProxy decoratingFacet = new PropertySetterFacetWrapProxy(propertySetterFacet, serverFacade, encoderDecoder, identifiedHolder.getIdentifier().getMemberName());
requiredHolder.addFacet(decoratingFacet);
return decoratingFacet;
}
if (facetType == PropertyClearFacet.class) {
final PropertyClearFacet propertyClearFacet = (PropertyClearFacet) facet;
final PropertyClearFacetWrapProxy decoratingFacet = new PropertyClearFacetWrapProxy(propertyClearFacet, serverFacade, encoderDecoder, identifiedHolder.getIdentifier().getMemberName());
requiredHolder.addFacet(decoratingFacet);
return decoratingFacet;
}
if (facetType == CollectionAddToFacet.class) {
final CollectionAddToFacet collectionAddToFacet = (CollectionAddToFacet) facet;
final CollectionAddToFacetWrapProxy decoratingFacet = new CollectionAddToFacetWrapProxy(collectionAddToFacet, serverFacade, encoderDecoder, identifiedHolder.getIdentifier().getMemberName());
requiredHolder.addFacet(decoratingFacet);
return decoratingFacet;
}
if (facetType == CollectionRemoveFromFacet.class) {
final CollectionRemoveFromFacet collectionRemoveFromFacet = (CollectionRemoveFromFacet) facet;
final CollectionRemoveFromFacetWrapProxy decoratingFacet = new CollectionRemoveFromFacetWrapProxy(collectionRemoveFromFacet, serverFacade, encoderDecoder, identifiedHolder.getIdentifier().getMemberName());
requiredHolder.addFacet(decoratingFacet);
return decoratingFacet;
}
if (facetType == ActionInvocationFacet.class) {