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

Examples of org.apache.isis.core.metamodel.facets.object.value.ValueFacet


        final ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
       
        // use the runtime type if we have a value, else the compile time type of the member otherwise
        final ObjectSpecification spec = valueAdapter != null? valueAdapter.getSpecification(): objectMember.getSpecification();
       
        final ValueFacet valueFacet = spec.getFacet(ValueFacet.class);
        if (valueFacet != null) {
            JsonValueEncoder.appendValueAndFormat(spec, valueAdapter, representation);
            return;
        }
View Full Code Here


    public void testFacetPickedUp() {

        facetFactory.process(new ProcessClassContext(MyParseableUsingParserName2.class, methodRemover, facetedMethod));

        final ValueFacet facet = facetedMethod.getFacet(ValueFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof ValueFacetAnnotation);
    }
View Full Code Here

        final ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
       
        // use the runtime type if we have a value, else the compile time type of the member otherwise
        final ObjectSpecification spec = valueAdapter != null? valueAdapter.getSpecification(): objectMember.getSpecification();
       
        final ValueFacet valueFacet = spec.getFacet(ValueFacet.class);
        if (valueFacet != null) {
            String format = null;
            final Class<?> specClass = spec.getCorrespondingClass();
            if(specClass == java.math.BigDecimal.class) {
                // look for facet on member, else on the value's spec
View Full Code Here

    public ApplicationAdvice appliesTo(final IModel<?> model) {
        if (!(model instanceof ScalarModel)) {
            return ApplicationAdvice.DOES_NOT_APPLY;
        }
        final ScalarModel scalarModel = (ScalarModel) model;
        final ValueFacet valueFacet = scalarModel.getTypeOfSpecification().getFacet(ValueFacet.class);
        if(valueFacet == null) {
            return ApplicationAdvice.DOES_NOT_APPLY;
        }
        return appliesIf(!scalarModel.hasChoices());
    }
View Full Code Here

    public void testFacetPickedUp() {

        facetFactory.process(new ProcessClassContext(MyParseableUsingParserName2.class, methodRemover, facetedMethod));

        final ValueFacet facet = facetedMethod.getFacet(ValueFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof ValueFacetAnnotation);
    }
View Full Code Here

    public ApplicationAdvice appliesTo(final IModel<?> model) {
        if (!(model instanceof ScalarModel)) {
            return ApplicationAdvice.DOES_NOT_APPLY;
        }
        final ScalarModel scalarModel = (ScalarModel) model;
        final ValueFacet facet = scalarModel.getTypeOfSpecification().getFacet(ValueFacet.class);
        return appliesIf(facet != null);
    }
View Full Code Here

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

    public static Object valueOrRef(final ResourceContext resourceContext, final ObjectAdapter objectAdapter, final ObjectSpecification objectSpec) {
        final ValueFacet valueFacet = objectSpec.getFacet(ValueFacet.class);
        if (valueFacet != null) {
            return new JsonValueEncoder().asObject(objectAdapter);
        }
        final TitleFacet titleFacet = objectSpec.getFacet(TitleFacet.class);
        final String title = titleFacet.title(objectAdapter, resourceContext.getLocalization());
View Full Code Here

    public void testFacetPickedUp() {

        facetFactory.process(new ProcessClassContext(MyParseableUsingParserName2.class, methodRemover, facetedMethod));

        final ValueFacet facet = facetedMethod.getFacet(ValueFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof ValueFacetAnnotation);
    }
View Full Code Here

    public ApplicationAdvice appliesTo(final IModel<?> model) {
        if (!(model instanceof ScalarModel)) {
            return ApplicationAdvice.DOES_NOT_APPLY;
        }
        final ScalarModel scalarModel = (ScalarModel) model;
        final ValueFacet facet = scalarModel.getTypeOfSpecification().getFacet(ValueFacet.class);
        return appliesIf(facet != null);
    }
View Full Code Here

    protected Object valueRep() {
        ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
        if(valueAdapter == null) {
            return null;
        }
        ValueFacet valueFacet = getMemberSpecFacet(ValueFacet.class);
        if(valueFacet != null) {
            EncodableFacet encodableFacet = getMemberSpecFacet(EncodableFacet.class);
            return encodableFacet.toEncodedString(valueAdapter);
        }
        TitleFacet titleFacet = getMemberSpecFacet(TitleFacet.class);
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.object.value.ValueFacet

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.