Package org.apache.isis.core.metamodel.facets

Examples of org.apache.isis.core.metamodel.facets.FacetedMethod


    }

    @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(
View Full Code Here


    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {

        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
        final Class<?> cls = processMethodContext.getCls();
        final Method method = processMethodContext.getMethod();

        final ActionSemanticsFacet actionSemanticsFacet = facetHolder.getFacet(ActionSemanticsFacet.class);
        if(actionSemanticsFacet == null) {
            throw new IllegalStateException("Require ActionSemanticsFacet in order to process");
        }
        if(facetHolder.containsDoOpFacet(CommandFacet.class)) {
            // do not replace
            return;
        }
        if(HasTransactionId.class.isAssignableFrom(cls)) {
            // do not install on any implementation of HasTransactionId
View Full Code Here

    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {
        final Class<?> type = processMethodContext.getMethod().getReturnType();
        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
        addFacetDerivedFromTypeIfPresent(facetHolder, type);
    }
View Full Code Here

        processClassContext.removeMethod(method);
    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {
        final FacetedMethod member = processMethodContext.getFacetHolder();
        final Class<?> owningClass = processMethodContext.getCls();
        final ObjectSpecification owningSpec = getSpecificationLoader().loadSpecification(owningClass);
        final DisabledObjectFacet facet = owningSpec.getFacet(DisabledObjectFacet.class);
        if (facet != null) {
            facet.copyOnto(member);
View Full Code Here

        FacetUtil.addFacet(create(annotation, processClassContaxt.getFacetHolder()));
    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {
        final FacetedMethod member = processMethodContext.getFacetHolder();
        final Class<?> owningClass = processMethodContext.getCls();
        final ObjectSpecification owningSpec = getSpecificationLoader().loadSpecification(owningClass);
        final ImmutableFacet facet = owningSpec.getFacet(ImmutableFacet.class);
        if (facet != null) {
            facet.copyOnto(member);
View Full Code Here

    // ///////////////////////////////////////////////////////

    @Override
    public void process(final ProcessMethodContext processMethodContext) {

        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();

        attachAutoCompleteFacetForParametersIfAutoCompleteNumMethodIsFound(processMethodContext, holderList);

    }
View Full Code Here

    // ///////////////////////////////////////////////////////

    @Override
    public void process(final ProcessMethodContext processMethodContext) {

        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();

        attachChoicesFacetForParametersIfChoicesNumMethodIsFound(processMethodContext, holderList);

    }
View Full Code Here

                continue;
            }
           
            processMethodContext.removeMethod(choicesMethod);

            final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
            if (facetedMethod.containsDoOpFacet(ActionChoicesFacet.class)) {
                final Class<?> cls = processMethodContext.getCls();
                throw new MetaModelException(cls + " uses both old and new choices syntax - must use one or other");
            }

            // add facets directly to parameters, not to actions
View Full Code Here

    // ///////////////////////////////////////////////////////

    @Override
    public void process(final ProcessMethodContext processMethodContext) {

        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();

        attachNamedFacetForParametersIfParameterNamesMethodIsFound(processMethodContext, holderList);
    }
View Full Code Here

    // ///////////////////////////////////////////////////////

    @Override
    public void process(final ProcessMethodContext processMethodContext) {

        final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
        final List<FacetedMethodParameter> holderList = facetedMethod.getParameters();

        attachDescribedAsFacetForParametersIfParameterDescriptionsMethodIsFound(processMethodContext, holderList);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.FacetedMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.