/*
* Copyright (c) 2010 Mysema Ltd.
* All rights reserved.
*
*/
package com.mysema.rdfbean.annotations;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Allows defining a default value for object/reference properties. For example
* a default Role of a User:
*
* <pre>
* @ClassMapping(ns=TEST.NS)
* public class User {
*
* @Default(ns=TEST.NS, "UserRole")
* @Predicate
* private Role role;
* ...
* }
* </pre>
*
* @Default can also be used as such without @Predicate in order to
* define non changeable references. This is particulary useful in conjunction
* with @Inject for injecting named services to beans:
*
* <pre>
* @Default(ns=TEST.SERVICES_NS, "userService")
* @Inject
* private UserService userService;
* </pre>
*
* @author sasa
*/
@Documented
@Target({ METHOD, FIELD, PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Default {
/**
* @return The local name of the resource URI. If namespace (ns) is not
* given, this is should be the full URI.
*/
String ln() default "";
/**
* @return Namespace of the resource or empty string, if localName contains
* whole URI.
*/
String ns();
}