Examples of MandatoryFacet


Examples of org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet

   
    public void testReferenceWithNoAllowsNull_isOptional() throws Exception {
        final Method method = cls.getMethod("getReferenceWithNoAllowsNull");
        facetFactory.process(new FacetFactory.ProcessMethodContext(cls, null, null, method, methodRemover, facetedMethod));
       
        final MandatoryFacet facet = facetedMethod.getFacet(MandatoryFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof MandatoryFacetDerivedFromJdoColumn);
        assertThat(facet.isInvertedSemantics(), is(true));
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet

   
    public void testReferenceWithAllowsNullFalse() throws Exception {
        final Method method = cls.getMethod("getReferenceWithAllowsNullFalse");
        facetFactory.process(new FacetFactory.ProcessMethodContext(cls, null, null, method, methodRemover, facetedMethod));
       
        final MandatoryFacet facet = facetedMethod.getFacet(MandatoryFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof MandatoryFacetDerivedFromJdoColumn);
        assertThat(facet.isInvertedSemantics(), is(false));
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet

   
    public void testReferenceWithAllowsNullTrue() throws Exception {
        final Method method = cls.getMethod("getReferenceWithAllowsNullTrue");
        facetFactory.process(new FacetFactory.ProcessMethodContext(cls, null, null, method, methodRemover, facetedMethod));
       
        final MandatoryFacet facet = facetedMethod.getFacet(MandatoryFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof MandatoryFacetDerivedFromJdoColumn);
        assertThat(facet.isInvertedSemantics(), is(true));
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet

        return description == null ? "" : description;
    }

    @Override
    public boolean isOptional() {
        final MandatoryFacet facet = getFacet(MandatoryFacet.class);
        return facet.isInvertedSemantics();
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet

        return containsFacet(PropertyChoicesFacet.class);
    }

    @Override
    public boolean isMandatory() {
        final MandatoryFacet mandatoryFacet = getFacet(MandatoryFacet.class);
        return mandatoryFacet != null && !mandatoryFacet.isInvertedSemantics();
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet

    }

    @Override
    public void toDefault(final ObjectAdapter ownerAdapter) {
        // don't default optional fields
        final MandatoryFacet mandatoryFacet = getFacet(MandatoryFacet.class);
        if (mandatoryFacet != null && mandatoryFacet.isInvertedSemantics()) {
            return;
        }

        final ObjectAdapter defaultValue = getDefault(ownerAdapter);
        if (defaultValue != null) {
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet

        return description == null ? "" : description;
    }

    @Override
    public boolean isOptional() {
        final MandatoryFacet facet = getFacet(MandatoryFacet.class);
        return facet.isInvertedSemantics();
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet

        }
        final PropertyModifyContext propertyModifyContext = (PropertyModifyContext) context;
        ObjectAdapter proposed = propertyModifyContext.getProposed();
        if(proposed == null) {
            // skip validation if null value and optional property.
            MandatoryFacet mandatoryFacet = getFacetHolder().getFacet(MandatoryFacet.class);
            if(mandatoryFacet == null || mandatoryFacet.isNoop() || mandatoryFacet.isInvertedSemantics()) {
                return null;
            }
        }
        return invalidReason(propertyModifyContext.getTarget(), proposed);
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet

        return containsFacet(PropertyChoicesFacet.class);
    }

    @Override
    public boolean isMandatory() {
        final MandatoryFacet mandatoryFacet = getFacet(MandatoryFacet.class);
        return mandatoryFacet != null && !mandatoryFacet.isInvertedSemantics();
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet

    public void testPrimitiveWithNoAnnotation_isMandatory() throws Exception {
        final Method method = cls.getMethod("getPrimitiveWithNoAnnotation");
        facetFactory.process(new FacetFactory.ProcessMethodContext(cls, null, null, method, methodRemover, facetedMethod));

        final MandatoryFacet facet = facetedMethod.getFacet(MandatoryFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof MandatoryFacetInferredFromAbsenceOfJdoColumn);
        assertThat(facet.isInvertedSemantics(), is(false));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.