Examples of TypeOfFacet


Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

        // rootObject = new TestObject("Harry");
        // final ObjectAdapter nameAdapter = mockery.mock(ObjectAdapter.class,
        // "name");
        oid = mockery.mock(Oid.class);

        final TypeOfFacet typeOfFacet = mockery.mock(TypeOfFacet.class, "element 1");

        final Iterator<?> mockIterator = mockery.mock(Iterator.class);

        // object encoding
        mockery.checking(new Expectations() {
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

    }

    @Test
    @Override
    public void testTypeOfFacet() throws Exception {
        final TypeOfFacet facet = specification.getFacet(TypeOfFacet.class);
        Assert.assertNotNull(facet);
        Assert.assertEquals(TestPojo.class, facet.value());
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

        Assert.assertNull(facet);
    }

    @Test
    public void testNoTypeOfFacet() throws Exception {
        final TypeOfFacet facet = specification.getFacet(TypeOfFacet.class);
        Assert.assertNull(facet);
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

    }

    @Test
    @Override
    public void testTypeOfFacet() throws Exception {
        final TypeOfFacet facet = specification.getFacet(TypeOfFacet.class);
        Assert.assertNotNull(facet);
        Assert.assertEquals(Object.class, facet.value());
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

        Assert.assertNull(facet);
    }

    @Test
    public void testTypeOfFacet() throws Exception {
        final TypeOfFacet facet = specification.getFacet(TypeOfFacet.class);
        Assert.assertNull(facet);
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

            final FacetedMethod facetedMethod = FacetedMethod.createCollectionFacetedMethod(introspectedClass, accessorMethod);
            getFacetProcessor().process(introspectedClass, accessorMethod, methodRemover, facetedMethod, FeatureType.COLLECTION);

            // figure out what the type is
            Class<?> elementType = Object.class;
            final TypeOfFacet typeOfFacet = facetedMethod.getFacet(TypeOfFacet.class);
            if (typeOfFacet != null) {
                elementType = typeOfFacet.value();
            }
            facetedMethod.setType(elementType);

            // skip if class substitutor says so.
            if (getClassSubstitutor().getClass(elementType) == null) {
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
            }
            isFieldEditable = objectField.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed();
            getPersistenceSession().resolveField(object, objectField);
            collection = objectField.get(object);
            final TypeOfFacet facet = objectField.getFacet(TypeOfFacet.class);
            elementSpec = facet.valueSpec();
            parentObjectId = objectId == null ? context.mapObject(object, Scope.REQUEST) : objectId;
        } else {
            final String id = request.getOptionalProperty(COLLECTION);
            collection = context.getMappedObjectOrResult(id);
            elementSpec = collection.getElementSpecification();
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

public class CollectionMapping {
    private final Vector list = new Vector();
    private final ObjectSpecification elementSpecification;

    public CollectionMapping(final Context context, final ObjectAdapter collection) {
        final TypeOfFacet typeOfFacet = collection.getSpecification().getFacet(TypeOfFacet.class);
        elementSpecification = typeOfFacet.valueSpec();

        final CollectionFacet collectionFacet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
        final Enumeration elements = collectionFacet.elements(collection);
        while (elements.hasMoreElements()) {
            final ObjectAdapter element = (ObjectAdapter) elements.nextElement();
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

class TestCollectionType extends Test {
    @Override
    boolean test(final Request request, final String attributeName, final String targetId) {
        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
        final Class<?> cls = forClass(attributeName);
        final TypeOfFacet facet = object.getSpecification().getFacet(TypeOfFacet.class);
        final boolean hasType = object != null && (cls == null || cls.isAssignableFrom(facet.value()));
        return hasType;
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

        representation.mapPut("parameters", parameterList);
    }

    protected void addLinkToElementTypeIfAny() {
        final TypeOfFacet facet = getObjectFeature().getFacet(TypeOfFacet.class);
        if (facet == null) {
            return;
        }
        final ObjectSpecification typeOfSpec = facet.valueSpec();
        final LinkBuilder linkBuilder = DomainTypeReprRenderer.newLinkToBuilder(getResourceContext(), Rel.ELEMENT_TYPE, typeOfSpec);
        getLinks().arrayAdd(linkBuilder.build());
    }
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.