Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies this distribution. The Eclipse Public License is available at and the Eclipse Distribution License is available at Contributors: 08/10/2009-2.0 Guy Pelletier - 267391: JPA 2.0 implement/extend/use an APT tooling library for MetaModel API canonical classes /
 package org.eclipse.persistence.internal.jpa.modelgen.visitors;
 import java.util.List;
 import java.util.Set;
An annotation element visitor.

Guy Pelletier
EclipseLink 1.2
 public class AnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor6<ObjectObject> {
     public AnnotationValueVisitor() {}
INTERNAL: Visits an annotation mirror. Kicks off the building of the metadata annotation.
     public Object visitAnnotation(AnnotationMirror annotationMirrorObject arg1) {
         // Set the name of the annotation.
         MetadataAnnotation annotation = new MetadataAnnotation();
         // Process the values.
         Set<? extends ExecutableElementkeys = annotationMirror.getElementValues().keySet();
         for (ExecutableElement annotationElement : keys) {
             AnnotationValue annotationValue = annotationMirror.getElementValues().get(annotationElement);
             String attribute = annotationElement.getSimpleName().toString();
             Object attributeValue = annotationValue.accept(thisarg1);
         return annotation;

INTERNAL: e.g. joinColumns={

name="ID1", referencedColumnName="ID"),
name="ID2", referencedColumnName="ID")}
     public Object visitArray(List<? extends AnnotationValueannotationValuesObject arg1) {
         ArrayList<Objectvalues = new ArrayList<Object>();
         for (AnnotationValue annotationValue : annotationValues) {
         return values.toArray();

INTERNAL: e.g. shared=true
     public Object visitBoolean(boolean boolObject arg1) {
         return Boolean.valueOf(bool);

INTERNAL: e.g. byte=13
     public Object visitByte(byte bObject arg1) {
         return Byte.valueOf(b);

INTERNAL: e.g. type='c'
    public Object visitChar(char cObject arg1) {
        return Character.valueOf(c);

INTERNAL: e.g. size=6.02E23
    public Object visitDouble(double dObject arg1) {
        return Double.valueOf(d);

INTERNAL: e.g. fetch=LAZY
    public Object visitEnumConstant(VariableElement variableArgumentObject arg1) {
        return variableArgument.getSimpleName().toString();

INTERNAL: e.g. size=6.02e23f
    public Object visitFloat(float fObject arg1) {
        return Float.valueOf(f);

INTERNAL: e.g. size=730
    public Object visitInt(int iObject arg1) {
        return Integer.valueOf(i);

INTERNAL: e.g. size=9223372036854775807
    public Object visitLong(long lObject arg1) {
        return Long.valueOf(l);

INTERNAL: e.g. size=7
    public Object visitShort(short sObject arg1) {
        return Short.valueOf(s);

INTERNAL: e.g. name="findAllSQLEmployees"
    public Object visitString(String strObject arg1) {
        return str;

INTERNAL: e.g. targetEntity=Item.class
    public Object visitType(TypeMirror typeMirrorObject arg1) {
        return typeMirror.toString();
New to GrepCode? Check out our FAQ X