@Override public void processParams(final ProcessParameterContext processParameterContext) { final Class<?> paramType = processParameterContext.getMethod().getParameterTypes()[processParameterContext.getParamNum()]; if (!paramType.isEnum()) { return; } FacetUtil.addFacet(new ActionParameterChoicesFacetDerivedFromChoicesFacet(processParameterContext.getFacetHolder(), getSpecificationLookup(), getAdapterMap())); }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final Class<?> type = processParameterContext.getMethod().getParameterTypes()[processParameterContext.getParamNum()]; final FacetedMethodParameter facetHolder = processParameterContext.getFacetHolder(); addFacetDerivedFromTypeIfPresent(facetHolder, type); }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes(); if (processParameterContext.getParamNum() >= parameterTypes.length) { // ignore return; } if (parameterTypes[processParameterContext.getParamNum()].isPrimitive()) { return; } final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (final Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation instanceof Optional) { FacetUtil.addFacet(new MandatoryFacetInvertedByOptionalForParameter(processParameterContext.getFacetHolder())); return; } } }
/** * If there is a {@link DefaultedFacet} on any of the action's parameter * types, then installs a {@link ActionDefaultsFacet} for the action. */ @Override public void processParams(final ProcessParameterContext processParameterContext) { // don't overwrite any defaults already picked up if (processParameterContext.getFacetHolder().getFacet(ActionDefaultsFacet.class) != null) { return; } // try to infer defaults from any of the parameter's underlying types final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes(); final DefaultedFacet[] parameterTypeDefaultedFacets = new DefaultedFacet[parameterTypes.length]; boolean hasAtLeastOneDefault = false; for (int i = 0; i < parameterTypes.length; i++) { final Class<?> paramType = parameterTypes[i]; parameterTypeDefaultedFacets[i] = getDefaultedFacet(paramType); hasAtLeastOneDefault = hasAtLeastOneDefault | (parameterTypeDefaultedFacets[i] != null); } if (hasAtLeastOneDefault) { FacetUtil.addFacet(new ActionParameterDefaultFacetDerivedFromTypeFacets(parameterTypeDefaultedFacets, processParameterContext.getFacetHolder())); } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes(); if (processParameterContext.getParamNum() >= parameterTypes.length) { // ignore return; } if (!isString(parameterTypes[processParameterContext.getParamNum()])) { return; } final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (final Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation instanceof MultiLine) { final MultiLine annotation = (MultiLine) parameterAnnotation; FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder())); return; } } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes(); if (processParameterContext.getParamNum() >= parameterTypes.length) { // ignore return; } if (!isString(parameterTypes[processParameterContext.getParamNum()])) { return; } final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (final Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation instanceof RegEx) { final RegEx annotation = (RegEx) parameterAnnotation; addRegexFacetAndCorrespondingTitleFacet(processParameterContext.getFacetHolder(), annotation); return; } } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final int paramNum = processParameterContext.getParamNum(); final Class<?> parameterType = processParameterContext.getMethod().getParameterTypes()[paramNum]; final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[paramNum]; for (final Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation instanceof DescribedAs) { FacetUtil.addFacet(create((DescribedAs) parameterAnnotation, processParameterContext.getFacetHolder())); return; } } // otherwise, fall back to a description on the parameter's type, if // available final DescribedAsFacet parameterTypeDescribedAsFacet = getDescribedAsFacet(parameterType); if (parameterTypeDescribedAsFacet != null) { FacetUtil.addFacet(new DescribedAsFacetForParameterDerivedFromType(parameterTypeDescribedAsFacet, processParameterContext.getFacetHolder())); return; } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes(); if (processParameterContext.getParamNum() >= parameterTypes.length) { // ignore return; } final java.lang.annotation.Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (int i = 0; i < parameterAnnotations.length; i++) { if (parameterAnnotations[i] instanceof Mask) { final Mask annotation = (Mask) parameterAnnotations[i]; addMaskFacetAndCorrespondingTitleFacet(processParameterContext.getFacetHolder(), annotation, parameterTypes[i]); return; } } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes(); if (processParameterContext.getParamNum() >= parameterTypes.length) { // ignore return; } final java.lang.annotation.Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (int i = 0; i < parameterAnnotations.length; i++) { if (parameterAnnotations[i] instanceof Mask) { final Mask annotation = (Mask) parameterAnnotations[i]; addMaskFacetAndCorrespondingTitleFacet(processParameterContext.getFacetHolder(), annotation, parameterTypes[i]); return; } } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final java.lang.annotation.Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (final Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation instanceof MustSatisfy) { final MustSatisfy annotation = (MustSatisfy) parameterAnnotation; FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder())); return; } } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (final Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation instanceof TypicalLength) { final TypicalLength annotation = (TypicalLength) parameterAnnotation; FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder())); return; } } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (final Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation instanceof Named) { final Named annotation = (Named) parameterAnnotation; FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder())); return; } } }
@Override public void processParams(final ProcessParameterContext processParameterContext) { final java.lang.annotation.Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()]; for (final Annotation parameterAnnotation : parameterAnnotations) { if (parameterAnnotation instanceof MaxLength) { final MaxLength annotation = (MaxLength) parameterAnnotation; FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder())); return; } } }