/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Represents an annotation on a program element.
*
* TODO
* How to add enums to the annotations
* @author
* Bhakti Mehta (bhakti.mehta@sun.com)
*/
/**
* The {@link Annotation} class
*/
/**
* Map of member values.
*/
}
return clazz;
}
}
}
// Use ordered map to keep the code generation the same on any JVM.
// Lazily created.
if(memberValues==null)
}
/**
* Adds a member value pair to this annotation
*
* @param name
* The simple name for this annotation
*
* @param value
* The boolean value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The byte member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The char member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The double member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The float member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The long member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The short member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The int member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The String member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
//Escape string values with quotes so that they can
//be generated accordingly
return this;
}
/**
* Adds a member value pair to this annotation
* For adding class values as param
* @see #param(String, Class)
* @param name
* The simple name for this annotation
*
* @param value
* The annotation class which is member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return annotationUse;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The enum class which is member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
public void generate(JFormatter f) {
}
});
return this;
}
/**
* Adds a member value pair to this annotation
* @param name
* The simple name for this annotation
*
* @param value
* The JEnumConstant which is member value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair to this annotation
* This can be used for e.g to specify
* <pre>
* @XmlCollectionItem(type=Integer.class);
* <pre>
* For adding a value of Class<? extends Annotation>
* @link
* #annotationParam(java.lang.String, java.lang.Class<? extends java.lang.annotation.Annotation>)
* @param name
* The simple name for this annotation param
*
* @param value
* The class type of the param
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*
*
*/
new JExpressionImpl() {
public void generate(JFormatter f) {
f.p(".class");
}
}));
return this;
}
/**
* Adds a member value pair to this annotation based on the
* type represented by the given JType
*
* @param name The simple name for this annotation param
* @param type the JType representing the actual type
* @return The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*/
return this;
}
/**
* Adds a member value pair to this annotation.
* @param name
* The simple name for this annotation
*
* @param value
* The JExpression which provides the contant value for this annotation
* @return
* The JAnnotationUse. More member value pairs can
* be added to it using the same or the overloaded methods.
*
*/
return this;
}
/**
* Adds a member value pair which is of type array to this annotation
* @param name
* The simple name for this annotation
*
* @return
* The JAnnotationArrayMember. For adding array values
* @see JAnnotationArrayMember
*
*/
return arrayMember;
}
// /**
// * This can be used to add annotations inside annotations
// * for e.g @XmlCollection(values= @XmlCollectionItem(type=Foo.class))
// * @param className
// * The classname of the annotation to be included
// * @return
// * The JAnnotationUse that can be used as a member within this JAnnotationUse
// * @deprecated
// * use {@link JAnnotationArrayMember#annotate}
// */
// public JAnnotationUse annotate(String className) {
// JAnnotationUse annotationUse = new JAnnotationUse(owner().ref(className));
// return annotationUse;
// }
/**
* This can be used to add annotations inside annotations
* for e.g @XmlCollection(values= @XmlCollectionItem(type=Foo.class))
* @param clazz
* The annotation class to be included
* @return
* The JAnnotationUse that can be used as a member within this JAnnotationUse
* @deprecated
* use {@link JAnnotationArrayMember#annotate}
*/
return annotationUse;
}
f.p('@').g(clazz);
if(memberValues!=null) {
f.p('(');
boolean first = true;
if(isOptimizable()) {
// short form
} else {
if (!first) f.p(',');
first = false;
}
}
f.p(')');
}
}
private boolean isOptimizable() {
}
}