org.nakedobjects.noa.annotations.HiddenAnnotation Maven / Gradle / Ivy
The newest version!
package org.nakedobjects.noa.annotations;
import org.nakedobjects.noa.adapter.Naked;
import org.nakedobjects.noa.exceptions.HiddenDeclarativelyException;
public class HiddenAnnotation extends AbstractSingleWhenValueAnnotation implements Constraint {
public HiddenAnnotation(When value) {
super(EVERYTHING_BUT_PARAMETERS, value);
}
/**
* Always returns true.
*
*
* The fact that there is a hidden semantic means that any attempt to
* manipulate the object is invalid.
*/
public boolean violatedBy(
Naked argNaked) {
return true;
}
/**
* Always raises a {@link HiddenDeclarativelyException}.
*/
public RuntimeException createExceptionFor(
String id,
Naked argNaked) {
return new HiddenDeclarativelyException(id);
}
}