@Override protected boolean isId(Path<?> arg) { return arg.getAnnotatedElement().isAnnotationPresent(Id.class); }
@Override protected boolean isReference(Path<?> arg) { return arg.getAnnotatedElement().isAnnotationPresent(Reference.class); }
@Override protected String getKeyForPath(Path<?> expr, PathMetadata metadata) { AnnotatedElement annotations = expr.getAnnotatedElement(); if (annotations.isAnnotationPresent(Id.class)) { Path<?> parent = expr.getMetadata().getParent(); if (parent.getAnnotatedElement().isAnnotationPresent(Reference.class)) { return null; // go to parent } else { return "_id"; } } else if (annotations.isAnnotationPresent(Property.class)) { Property property = annotations.getAnnotation(Property.class); if (!property.value().equals(Mapper.IGNORED_FIELDNAME)) { return property.value(); } } else if (annotations.isAnnotationPresent(Reference.class)) { Reference reference = annotations.getAnnotation(Reference.class); if (!reference.value().equals(Mapper.IGNORED_FIELDNAME)) { return reference.value(); } } return super.getKeyForPath(expr, metadata); }
@Override public String toField(Path<?> path) { if (path.getAnnotatedElement() != null) { Field fieldAnn = path.getAnnotatedElement().getAnnotation(Field.class); if (fieldAnn != null && fieldAnn.name().length() > 0) { return fieldAnn.name(); } } return super.toField(path); }
@Override protected void appendAsColumnName(Path<?> path, boolean precededByDot) { if (path.getAnnotatedElement().isAnnotationPresent(Column.class)) { Column column = path.getAnnotatedElement().getAnnotation(Column.class); if (!column.name().isEmpty()) { append(getTemplates().quoteIdentifier(column.name(), precededByDot)); } else { super.appendAsColumnName(path, precededByDot); } } else { super.appendAsColumnName(path, precededByDot); } }
projection = ExpressionUtils.as(projection, alias); modified = true; } else if (path.getAnnotatedElement().isAnnotationPresent(Column.class)) { Column column = path.getAnnotatedElement().getAnnotation(Column.class); if (!column.name().isEmpty()) { aliases.put(path, column.name()); Path<?> path = (Path<?>) fargs.get(j); String columnName; if (path.getAnnotatedElement().isAnnotationPresent(Column.class)) { Column column = path.getAnnotatedElement().getAnnotation(Column.class); if (!column.name().isEmpty()) { columnName = column.name();