Package com.astamuse.asta4d.data.annotation

Examples of com.astamuse.asta4d.data.annotation.ContextDataSet


                if (isSet) {
                    mi.type = method.getParameterTypes()[0];
                    mi.fixForPrimitiveType();

                    ContextDataSet cdSet = findContextDataSetAnnotation(mi.type.getAnnotations());
                    if (cdSet == null) {
                        mi.isContextDataSet = false;
                    } else {
                        mi.isContextDataSet = true;
                    }

                    target.setMethodList.add(mi);
                }

            }
        }

        // then retrieve fields information
        String objCls = Object.class.getName();
        Field[] flds;
        FieldInfo fi;
        while (!cls.getName().equals(objCls)) {
            flds = cls.getDeclaredFields();
            for (Field field : flds) {
                cd = findContextDataAnnotation(field.getAnnotations());
                if (cd != null) {
                    fi = new FieldInfo();
                    fi.field = field;
                    fi.type = field.getType();

                    String delcaredName = cd == null ? "" : cd.name();
                    if (StringUtils.isEmpty(delcaredName)) {
                        fi.name = field.getName();
                    } else {
                        fi.name = cd.name();
                    }
                    fi.scope = cd == null ? "" : cd.scope();
                    fi.fixForPrimitiveType();

                    ContextDataSet cdSet = findContextDataSetAnnotation(fi.type.getAnnotations());
                    if (cdSet == null) {
                        fi.isContextDataSet = false;
                    } else {
                        fi.isContextDataSet = true;
                    }
View Full Code Here


        }
        Annotation[][] annotations = method.getParameterAnnotations();
        String[] parameterNames = paranamer.lookupParameterNames(method);
        TargetInfo target;
        ContextData cd;
        ContextDataSet cdSet;
        for (int i = 0; i < types.length; i++) {
            target = new TargetInfo();
            target.type = types[i];

            cd = findContextDataAnnotation(annotations[i]);
View Full Code Here

        }
        return cd;
    }

    private final static ContextDataSet findContextDataSetAnnotation(Annotation[] annotations) {
        ContextDataSet cdset = null;
        Class<?> cls;
        for (Annotation annotation : annotations) {
            cls = annotation.annotationType();
            if (cls.equals(ContextDataSet.class)) {
                cdset = (ContextDataSet) annotation;
View Full Code Here

                if (isSet) {
                    mi.type = method.getParameterTypes()[0];
                    mi.isContextDataHolder = ContextDataHolder.class.isAssignableFrom(mi.type);
                    mi.fixForPrimitiveType();

                    ContextDataSet cdSet = ConvertableAnnotationRetriever
                            .retrieveAnnotation(ContextDataSet.class, mi.type.getAnnotations());
                    if (cdSet == null) {
                        mi.contextDataSetFactory = null;
                    } else {
                        mi.contextDataSetFactory = cdSet.factory().newInstance();
                        mi.isContextDataSetSingletonInContext = cdSet.singletonInContext();
                    }

                    target.setMethodList.add(mi);
                }

            }
        }

        // then retrieve fields information
        String objCls = Object.class.getName();
        Field[] flds;
        FieldInfo fi;
        while (!cls.getName().equals(objCls)) {
            flds = cls.getDeclaredFields();
            for (Field field : flds) {
                cd = ConvertableAnnotationRetriever.retrieveAnnotation(ContextData.class, field.getAnnotations());
                if (cd != null) {
                    fi = new FieldInfo();
                    fi.field = field;
                    fi.type = field.getType();
                    fi.isContextDataHolder = ContextDataHolder.class.isAssignableFrom(fi.type);

                    String delcaredName = cd == null ? "" : cd.name();
                    if (StringUtils.isEmpty(delcaredName)) {
                        fi.name = field.getName();
                    } else {
                        fi.name = cd.name();
                    }
                    fi.scope = cd == null ? "" : cd.scope();
                    fi.typeUnMatch = cd.typeUnMatch();
                    fi.fixForPrimitiveType();

                    ContextDataSet cdSet = ConvertableAnnotationRetriever
                            .retrieveAnnotation(ContextDataSet.class, fi.type.getAnnotations());
                    if (cdSet == null) {
                        fi.contextDataSetFactory = null;
                    } else {
                        fi.contextDataSetFactory = cdSet.factory().newInstance();
                        fi.isContextDataSetSingletonInContext = cdSet.singletonInContext();
                    }

                    target.setFieldList.add(fi);

                    if (cd.reverse()) {//
View Full Code Here

        }
        Annotation[][] annotations = method.getParameterAnnotations();
        String[] parameterNames = paranamer.lookupParameterNames(method);
        TargetInfo target;
        ContextData cd;
        ContextDataSet cdSet;
        for (int i = 0; i < types.length; i++) {
            target = new TargetInfo();
            target.type = types[i];
            target.isContextDataHolder = ContextDataHolder.class.isAssignableFrom(target.type);

            cd = ConvertableAnnotationRetriever.retrieveAnnotation(ContextData.class, annotations[i]);
            cdSet = ConvertableAnnotationRetriever.retrieveAnnotation(ContextDataSet.class, target.type.getAnnotations());
            target.name = cd == null ? "" : cd.name();
            target.scope = cd == null ? "" : cd.scope();
            target.typeUnMatch = cd == null ? TypeUnMacthPolicy.DEFAULT_VALUE : cd.typeUnMatch();
            if (StringUtils.isEmpty(target.name)) {
                target.name = parameterNames[i];
            }

            if (cdSet == null) {
                target.contextDataSetFactory = null;
            } else {
                target.contextDataSetFactory = cdSet.factory().newInstance();
                target.isContextDataSetSingletonInContext = cdSet.singletonInContext();
            }

            target.fixForPrimitiveType();
            targetList.add(target);
        }
View Full Code Here

TOP

Related Classes of com.astamuse.asta4d.data.annotation.ContextDataSet

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.