Project

General

Profile

Evolution #3144

Use Annotation map instead of list in visitors

Added by Gregg C. about 7 years ago. Updated 11 months ago.

Status:
Nouveau
Priority:
Bas
Assignee:
Category:
Core
Target version:
Start date:
10/30/2013
Due date:
% Done:

0%

Estimated time:
Bdc:

Description

In all Java visitors, list of annotations are used, with multiple casts all along. Example :

if (norm.getPairs() != null) {
                for (final MemberValuePair mvp
                        : norm.getPairs()) {

                    // Argument of Annotation Column
                    if (annotationType.equals(FILTER_COLUMN)) {
                        // set nullable
                        if (mvp.getName().equals(ATTRIBUTE_NULLABLE)
                                && mvp.getValue().toString()
                                            .equals(String.valueOf(true))) {
                            result.setNullable(true);
                        } else

                        // set name
                        if (mvp.getName().equals(ATTRIBUTE_NAME)) {
                            if (mvp.getValue()
                                    instanceof StringLiteralExpr) {
                                result.setColumnName(
                                        ((StringLiteralExpr)
                                                mvp.getValue()).getValue());
                            } else {
                                result.setColumnName(
                                        mvp.getValue().toString());
                            }
                        } else [...]

A use of Maps, like :

result.setName(this.map.get(FILTER_COLUMN, ANNOTATION_NAME))

should be a lot nicer !


Recurrences

History

#4Updated by Erwan L. almost 7 years ago

Re-check later

Also available in: Atom PDF

Go to top
Add picture from clipboard (Maximum size: 200 MB)