info.novatec.testit.webtester.pagefragments.annotations.Attribute Maven / Gradle / Ivy
package info.novatec.testit.webtester.pagefragments.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import info.novatec.testit.webtester.pagefragments.PageFragment;
/**
* Marks an {@link PageFragment page fragment} method to return the value of a certain attribute.
*
* Example:
*
* public interface SomePageFragment extends PageFragment {
*
* // will return the value of the 'foo.bar' attribute of this page fragment as a Long
* @Attribute("foo.bar")
* Long fooBar();
*
* }
*
* The following return types are supported:
*
* - String
* - Boolean
* - Integer
* - Long
* - Float
* - Double
* - Optional<String>
* - Optional<Boolean>
* - Optional<Integer>
* - Optional<Long>
* - Optional<Float>
* - Optional<Double>
*
*
* Constraints: The annotation is only evaluated for page fragment methods without a (default) implementation!
*
* @see PageFragment
* @since 2.0
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Attribute {
/**
* The name of the attribute who's value should be returned by the annotated method.
*
* @return the name of the attribute
*/
String value();
}