Examples of Transformer


Examples of org.apache.commons.collections.Transformer

                    }
                });

        // Let's remove the "ejb" from it's name
        finderMethods = CollectionUtils.collect(finderMethods,
                new Transformer() {
                    public Object transform(Object object) {
                        return ejbUtils.externalizeMethodName((JavaMethod) object);

                        // return ejbUtils.removeFromMethodName((JavaMethod) object, "ejb");
                    }
                });

        Collection finderMethodsBySignature = CollectionUtils.select(Arrays.asList(javaClass.getTagsByName(
                    TagLibrary.EJB_FINDER, true)),
                new Predicate() {
                    public boolean evaluate(Object object) {
                        EjbFinderTag finderTag = (EjbFinderTag) object;
                        boolean retVal = finderTag.getResultTypeMapping() == null ||
                            finderTag.getResultTypeMapping().equals(EjbUtils.REMOTE_INTERFACE);
                        retVal = retVal && EjbUtils.hasFlag(ejbUtils.getViewType(finderTag.getViewType()), viewType);
                        return retVal;
                    }
                });

        finderMethods.addAll(CollectionUtils.collect(finderMethodsBySignature,
                new Transformer() {
                public Object transform(Object object) {
                    EjbFinderTag finderTag = (EjbFinderTag) object;
                    return ejbUtils.getFinderMethodBySignature(finderTag.getSignature());
                }
            }));

        // Add mandatory findByPrimaryKey if not already there
        // Is this only for CMP ?? (xdoclet-1.2.3 says so, but i'll ignore
        // it for consistency, but it has a point anyway..
        // TODO: Centralize "findByPrimaryKey" /EjbPkTag somewhere..
        // if (ejbUtils.isCMP(javaClass)) {
        // Let's check if there is at least one "findByPrimaryKey"
        int count = CollectionUtils.countMatches(finderMethods,
                new Predicate() {
                    public boolean evaluate(Object object) {
                        JavaMethod method = (JavaMethod) object;
                        return "findByPrimaryKey".equals(method.getName());
                    }
                });

        if (count == 0) {
            // Let's generate it then
            PrimaryKeyClassPlugin pkPlugin = EjbRuntime.getPrimaryKeyClassPlugin();
            JavaParameter javaParameter = new JavaParameter(new Type(pkPlugin.pkClass(javaClass)), "pk");
            JavaMethod finderMethod = new JavaMethod();
            finderMethod.setName("findByPrimaryKey");
            finderMethod.setParameters(new JavaParameter[] {javaParameter});

            // Let's add it finally
            finderMethods.add(finderMethod);
        }

        // }
        finderMethods = CollectionUtils.collect(finderMethods,
                new Transformer() {
                    public Object transform(Object object) {
                        return fixFinderReturnType((JavaMethod) object, newType);
                    }
                });
        finderMethods = ejbUtils.injectMethodThrowException(finderMethods, FinderException.class);
View Full Code Here

Examples of org.apache.commons.collections.Transformer

    }

    public Collection getRelationships(Collection metadata) {
        RelationManager relationManager = ejbUtils.createRelationManager(metadata);
        return CollectionUtils.collect(Arrays.asList(relationManager.getRelations()),
            new Transformer() {
                public Object transform(Object arg0) {
                    return new RelationHolder((Relation) arg0);
                }
            });
    }
View Full Code Here

Examples of org.apache.commons.collections.Transformer

        return retLst;
    }

    public Collection injectMethodThrowException(final Collection methods, final Class exceptionClass) {
        return CollectionUtils.collect(methods,
            new Transformer() {
                public Object transform(Object method) {
                    SignatureDuplicatedJavaMethod retVal = new SignatureDuplicatedJavaMethod((JavaMethod) method);
                    Type ex = new Type(exceptionClass.getName());

                    if (!retVal.containsException(ex)) {
View Full Code Here

Examples of org.apache.commons.collections.Transformer

                    return ((AssociationEndFacade)object).isComposition();
                }
            };
        CollectionUtils.transform(
            childEnds,
            new Transformer()
            {
                public Object transform(Object object)
                {
                    return ((AssociationEndFacade)object).getOtherEnd();
                }
View Full Code Here

Examples of org.apache.commons.collections.Transformer

                    return ((AssociationEndFacade)object).isComposition();
                }
            };
        CollectionUtils.transform(
            childEnds,
            new Transformer()
            {
                public Object transform(final Object object)
                {
                    return ((AssociationEndFacade)object).getOtherEnd();
                }
View Full Code Here

Examples of org.apache.commons.collections.Transformer

     */
    public Collection handleGetSpecializations()
    {
        Collection specializations = new ArrayList(UML14MetafacadeUtils.getCorePackage().getAParentSpecialization()
                .getSpecialization(this.metaObject));
        CollectionUtils.transform(specializations, new Transformer()
        {
            public Object transform(Object object)
            {
                return ((Generalization)object).getChild();
            }
View Full Code Here

Examples of org.apache.commons.collections.Transformer

                    Role.class.isAssignableFrom(dependency.getSourceElement().getClass());
                }
            });
        CollectionUtils.transform(
            operationRoles,
            new Transformer()
            {
                public Object transform(Object object)
                {
                    return ((DependencyFacade)object).getSourceElement();
                }
View Full Code Here

Examples of org.apache.commons.collections.Transformer

                    return dependency != null && dependency.getSourceElement() instanceof Role;
                }
            });
        CollectionUtils.transform(
            roles,
            new Transformer()
            {
                public Object transform(final Object object)
                {
                    return ((DependencyFacade)object).getSourceElement();
                }
View Full Code Here

Examples of org.apache.commons.collections.Transformer

            {
                DependencyFacade dependency = (DependencyFacade)object;
                return dependency != null && dependency.getSourceElement() instanceof Role;
            }
        });
        CollectionUtils.transform(roles, new Transformer()
        {
            public Object transform(final Object object)
            {
                return ((DependencyFacade)object).getSourceElement();
            }
View Full Code Here

Examples of org.apache.commons.collections.Transformer

    protected java.util.Collection handleGetNavigableConnectingEnds()
    {
        final Collection connectingEnds = new ArrayList(this.getAssociationEnds());
        CollectionUtils.transform(
            connectingEnds,
            new Transformer()
            {
                public Object transform(final Object object)
                {
                    return ((AssociationEndFacade)object).getOtherEnd();
                }
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.