1 ///* 2 // * The contents of this file are subject to the terms of the Common Development 3 // * and Distribution License (the License). You may not use this file except in 4 // * compliance with the License. 5 // * 6 // * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 // * or http://www.netbeans.org/cddl.txt. 8 // * 9 // * When distributing Covered Code, include this CDDL Header Notice in each file 10 // * and include the License file at http://www.netbeans.org/cddl.txt. 11 // * If applicable, add the following below the CDDL Header, with the fields 12 // * enclosed by brackets [] replaced by your own identifying information: 13 // * "Portions Copyrighted [year] [name of copyright owner]" 14 // * 15 // * The Original Software is NetBeans. The Initial Developer of the Original 16 // * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 // * Microsystems, Inc. All Rights Reserved. 18 // */ 19 // 20 //package org.netbeans.modules.j2ee.persistence.editor.completion; 21 // 22 //import java.util.ArrayList; 23 //import java.util.Collections; 24 //import java.util.Iterator; 25 //import java.util.List; 26 //import javax.naming.OperationNotSupportedException; 27 //import org.netbeans.jmi.javamodel.Annotation; 28 //import org.netbeans.jmi.javamodel.AttributeValue; 29 //import org.netbeans.jmi.javamodel.InitialValue; 30 //import org.netbeans.jmi.javamodel.JavaClass; 31 //import org.netbeans.jmi.javamodel.StringLiteral; 32 //import org.openide.util.NotImplementedException; 33 // 34 ///** 35 // * 36 // * @author Andrei Badea 37 // */ 38 // TOOD: RETOUCHE 39 //public class AnnotationUtils { 40 // 41 // private AnnotationUtils() { 42 // assert false; 43 // } 44 // 45 // // XXX maybe just put this in JMIUtils 46 // 47 // public static Annotation getAnnotationByTypeName(JavaClass cls, String typeName) { 48 // assert cls != null; 49 // assert typeName != null; 50 // 51 // for (Iterator i = cls.getAnnotations().iterator(); i.hasNext();) { 52 // Annotation annotation = (Annotation)i.next(); 53 // if (typeName.equals(annotation.getType().getName())) { 54 // return annotation; 55 // } 56 // } 57 // 58 // return null; 59 // } 60 // 61 // /** 62 // * Returns an annotation member value when this value is a string literal. 63 // */ 64 // public static String getStringMemberValue(Annotation annotation, String memberName) { 65 // assert annotation != null; 66 // assert memberName != null; 67 // 68 // for (Iterator i = annotation.getAttributeValues().iterator(); i.hasNext();) { 69 // AttributeValue attr = (AttributeValue)i.next(); 70 // if (memberName.equals(attr.getDefinition().getName())) { 71 // InitialValue value = attr.getValue(); 72 // if (value instanceof StringLiteral) { 73 // return ((StringLiteral)value).getValue(); 74 // } 75 // } 76 // } 77 // 78 // return null; 79 // } 80 // 81 // /** 82 // * Returns an annotation member value when this value is an array of annotations. 83 // */ 84 // public static List/*<Annotation>*/ getAnnotationsMemberValue(Annotation annotation, String memberName) { 85 // throw new org.openide.util.NotImplementedException("Not implemented because of missing test data due to issue 70701"); // NOI18N 86 // 87 //// assert annotation != null; 88 //// assert memberName != null; 89 //// 90 //// List result = new ArrayList(); 91 //// 92 //// for (Iterator i = annotation.getAttributeValues().iterator(); i.hasNext();) { 93 //// AttributeValue attr = (AttributeValue)i.next(); 94 //// if (memberName.equals(attr.getDefinition().getName())) { 95 //// 96 //// } 97 //// } 98 //// 99 //// return Collections.EMPTY_LIST; 100 // } 101 //} 102