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

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


        }
        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

        return containsFacet(PropertyChoicesFacet.class);
    }

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

    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

   
    public void testPrimitiveWithNoAllowsNull_isMandatory() throws Exception {
        final Method method = cls.getMethod("getPrimitiveWithNoAllowsNull");
        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

   
    public void testPrimitiveWithAllowsNullFalse() throws Exception {
        final Method method = cls.getMethod("getPrimitiveWithAllowsNullFalse");
        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

    public void testPrimitiveWithAllowsNullTrue() throws Exception {
        final Method method = cls.getMethod("getPrimitiveWithAllowsNullTrue");
        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

   
    public void testReferenceWithNoAnnotation_isOptional() throws Exception {
        final Method method = cls.getMethod("getReferenceWithNoAnnotation");
        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(true));
    }
View Full Code Here

   
    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

   
    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

TOP

Related Classes of org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet

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.