Package com.alibaba.druid.support.monitor.annotation

Examples of com.alibaba.druid.support.monitor.annotation.MTable


        public BeanInfo(Class<?> clazz){
            this.clazz = clazz;

            {
                MTable annotation = clazz.getAnnotation(MTable.class);
                if (annotation == null) {
                    throw new IllegalArgumentException(clazz.getName() + " not contains @MTable");
                }

                tableName = annotation.name();
            }

            for (Field field : clazz.getDeclaredFields()) {
                MField annotation = field.getAnnotation(MField.class);
                if (annotation == null) {
                    continue;
                }

                String columnName = annotation.name();
                if (StringUtils.isEmpty(columnName)) {
                    columnName = field.getName();
                }

                Field hashFor = null;
                String hashForType = null;
                if (!StringUtils.isEmpty(annotation.hashFor())) {
                    try {
                        hashFor = clazz.getDeclaredField(annotation.hashFor());
                        hashForType = annotation.hashForType();
                    } catch (Exception e) {
                        throw new IllegalStateException("hashFor error", e);
                    }
                }

                FieldInfo fieldInfo = new FieldInfo(field, columnName, hashFor, hashForType);
                fields.add(fieldInfo);

                if (annotation.groupBy()) {
                    groupByFields.add(fieldInfo);
                }

                if (hashFor != null) {
                    hashFields.add(fieldInfo);
View Full Code Here


        public BeanInfo(Class<?> clazz){
            this.clazz = clazz;

            {
                MTable annotation = clazz.getAnnotation(MTable.class);
                if (annotation == null) {
                    throw new IllegalArgumentException(clazz.getName() + " not contains @MTable");
                }

                tableName = annotation.name();
            }

            for (Field field : clazz.getDeclaredFields()) {
                MField annotation = field.getAnnotation(MField.class);
                if (annotation == null) {
                    continue;
                }

                String columnName = annotation.name();
                if (StringUtils.isEmpty(columnName)) {
                    columnName = field.getName();
                }

                Field hashFor = null;
                String hashForType = null;
                if (!StringUtils.isEmpty(annotation.hashFor())) {
                    try {
                        hashFor = clazz.getDeclaredField(annotation.hashFor());
                        hashForType = annotation.hashForType();
                    } catch (Exception e) {
                        throw new IllegalStateException("hashFor error", e);
                    }
                }

                FieldInfo fieldInfo = new FieldInfo(field, columnName, hashFor, hashForType);
                fields.add(fieldInfo);

                if (annotation.groupBy()) {
                    groupByFields.add(fieldInfo);
                }

                if (hashFor != null) {
                    hashFields.add(fieldInfo);
View Full Code Here

TOP

Related Classes of com.alibaba.druid.support.monitor.annotation.MTable

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.