net.sourceforge.jenesis4java.AnnotationAttribute Maven / Gradle / Ivy
package net.sourceforge.jenesis4java;
/*
* #%L
* Jenesis 4 Java Code Generator
* %%
* Copyright (C) 2000 - 2015 jenesis4java
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program 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 Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import java.util.List;
/**
* Copyright (C) 2008, 2010 Richard van Nieuwenhoven - ritchie [at] gmx [dot] at
* Copyright (C) 2000, 2001 Paul Cody Johnston - [email protected]
* This file is part of Jenesis4java. Jenesis4java is free software: you can
* redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
* Jenesis4java 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 Lesser General Public License for more
* details.
* You should have received a copy of the GNU Lesser General Public License
* along with Jenesis4java. If not, see .
*/
public interface AnnotationAttribute extends Codeable {
AnnotationAttribute addValue(Expression value);
AnnotationAttribute addValues(Iterable values);
AnnotationAttribute addValueAnnotation(Annotation valueAnnotation);
List getValuesCopy();
/**
* @return The name of this attribute. If no attribute is set (i.e., the
* default parameter {@code value} in the annotation is referenced),
* the name is the empty String.
*/
String getName();
/**
* @return The first value, if one or more value is set, or {@code null} if
* no value is set.
*/
Expression getValue();
/**
* Returns, if this attribute is the default value (i.e., maps to the
* parameter {@code value}, but is set without name. The name is not
* printed, only the value is.
*
* @see Annotation#addDefaultValueAttribute(Expression...)
*/
boolean isDefaultValueAttribute();
Annotation getValueAnnotation();
Annotation[] getValueAnnotations();
/**
* Returns if more than one value is set. If more than one value is set, the
* generated code is printed in curly brackets (the Java array definition
* syntax).
*/
boolean isArray();
/**
* Will be removed in a future release.
*
* @deprecated Array property should not be settable, but is derived from
* the number of values.
*/
@Deprecated
AnnotationAttribute setArray(boolean isArray);
/**
* Sets the name of this attribute.
*
* @param name
* The parameter name of the attribute in the annotation. If this
* is the only attribute and it is named {@code value}, you can
* provide an empty String for concise output code. {@code null}
* is normalized to the empty String.
* @return This reference for chaining.
*/
AnnotationAttribute setName(String name);
AnnotationAttribute setValueAnnotation(Annotation valueAnnotation);
AnnotationAttribute setValueAnnotations(Annotation[] valueAnnotation);
AnnotationAttribute setValue(Expression value);
/**
* @deprecated use {@link #addValue(Expression)} or
* {@link #addValues(Iterable)} instead.
*/
@Deprecated
AnnotationAttribute setValues(Expression[] value);
/**
* @deprecated Using arrays in interfaces is discouraged. Use
* {@link #getValuesCopy()} instead.
*/
@Deprecated
Expression[] getValues();
}