Author: tchemit Date: 2013-07-11 16:17:37 +0200 (Thu, 11 Jul 2013) New Revision: 1287 Url: http://nuiton.org/projects/eugene/repository/revisions/1287 Log: fixes #2738: Improve api to add annotations (improve doc) Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java trunk/eugene/src/main/java/org/nuiton/eugene/java/extension/ObjectModelAnnotation.java Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java =================================================================== --- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java 2013-07-11 13:53:23 UTC (rev 1286) +++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java 2013-07-11 14:17:37 UTC (rev 1287) @@ -297,24 +297,23 @@ /** * Add an annotation on an element of a classifier. * - * @param classifier where the annotation will be added. - * @param element element on which add annotation + * @param classifier where the annotation will be added. + * @param element element on which add annotation * @param annotationType type of annotation to add * @return the instanciated annotation */ public ObjectModelAnnotation addAnnotation(ObjectModelClassifier classifier, - ObjectModelElement element, - String annotationType) { + ObjectModelElement element, + String annotationType) { Preconditions.checkNotNull("Can't add a null annotation"); - Preconditions.checkArgument(SourceVersion.isName(annotationType),"Annotation type must be a valid type , but was: "+annotationType); -// if (annotation == null) { -// return; -// } + Preconditions.checkArgument( + SourceVersion.isName(annotationType), + "Annotation type must be a valid type , but was: " + annotationType); AnnotationsManager manager = annotationsManagerExtension.getManager(classifier); -// annotation = annotation.trim(); - ObjectModelAnnotation annotation = new ObjectModelAnnotation(annotationType); + ObjectModelAnnotation annotation = + new ObjectModelAnnotation(annotationType); manager.addAnnotation(element, annotation); if (log.isDebugEnabled()) { log.debug("Add annotation for <" + classifier.getQualifiedName() + Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java =================================================================== --- trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java 2013-07-11 13:53:23 UTC (rev 1286) +++ trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java 2013-07-11 14:17:37 UTC (rev 1287) @@ -425,12 +425,17 @@ /** * Add an annotation of the given {@code element} of the given {@code classifier}. - * + * <p/> + * <strong>Important note:</strong> + * <pre> + * Since 2.6.4, the behaviour of this method has changed, we only allowed + * now to pass here a annotation type and no longer a annotation + * string representation with some parameters... + * </pre> * @param classifier holder of element to treat * @param element where to add the annotation * @param annotationType type of annotation to create * @return the instanciated annotation - * @since 2.6.4 */ public ObjectModelAnnotation addAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/extension/ObjectModelAnnotation.java =================================================================== --- trunk/eugene/src/main/java/org/nuiton/eugene/java/extension/ObjectModelAnnotation.java 2013-07-11 13:53:23 UTC (rev 1286) +++ trunk/eugene/src/main/java/org/nuiton/eugene/java/extension/ObjectModelAnnotation.java 2013-07-11 14:17:37 UTC (rev 1287) @@ -47,7 +47,6 @@ return type; } - public List<ObjectModelAnnotationParameter> getParameters() { return parameters; }