/** * Returns the requested extension (if any) on the underlying * {@link #getNakedObjectActionParameter() action parameter}. */ public Object getExtension( Class extensionClass) { return getNakedObjectActionParameter().getExtension(extensionClass); }
protected Annotation getAnnotation(NakedObjectActionParameterInstance noapi, Class annotationClazz) { return (Annotation) noapi.getNakedObjectActionParameter().getExtension(annotationClazz); }
private Consent checkParamRegEx(int position, Naked argNaked) { NakedObjectActionParameter parameter = getParameter(position); Constraint regExConstraint = (RegExAnnotation) parameter.getExtension(RegExAnnotation.class); if (regExConstraint == null) { return Allow.DEFAULT; } if (regExConstraint.violatedBy(argNaked)) { return new Veto(regExConstraint.createExceptionFor(getId(), argNaked)); } return Allow.DEFAULT; }
private Consent checkParamMaxLength(int position, Naked argNaked) { NakedObjectActionParameter parameter = getParameter(position); Constraint maxLengthConstraint = (MaxLengthAnnotation) parameter.getExtension(MaxLengthAnnotation.class); if (maxLengthConstraint == null) { return Allow.DEFAULT; } if (maxLengthConstraint.violatedBy(argNaked)) { return new Veto(maxLengthConstraint.createExceptionFor(getId(), argNaked)); } return Allow.DEFAULT; }
private Consent checkParamMandatory(int position, Naked argNaked) { NakedObjectActionParameter parameter = getParameter(position); Constraint mandatoryConstraint = (MandatorySemantic) parameter.getExtension(MandatorySemantic.class); if (mandatoryConstraint == null) { return Allow.DEFAULT; } int parameterType = parameter.getSpecification().getType(); if (parameterType != HasType.OBJECT && parameterType != HasType.VALUE) { return Allow.DEFAULT; } if (mandatoryConstraint.violatedBy(argNaked)) { return new Veto(mandatoryConstraint.createExceptionFor(getId(), argNaked)); } return Allow.DEFAULT; }