use of com.linkedin.restli.server.annotations.Optional in project rest.li by linkedin.
the class RestLiAnnotationReader method buildProjectionParam.
private static Parameter<?> buildProjectionParam(final AnnotationSet annotations, final Class<?> paramType, final Parameter.ParamType projectionType) {
if (!paramType.equals(MaskTree.class)) {
throw new ResourceConfigException("Incorrect data type for param: @" + ProjectionParam.class.getSimpleName() + ", @" + Projection.class.getSimpleName() + ", @" + MetadataProjectionParam.class.getSimpleName() + " or @" + PagingProjectionParam.class.getSimpleName() + " parameter annotation must be of type " + MaskTree.class.getName());
}
Optional optional = annotations.get(Optional.class);
@SuppressWarnings({ "unchecked", "rawtypes" }) Parameter<?> param = new Parameter("", paramType, null, optional != null, // default mask is null.
null, projectionType, false, annotations);
return param;
}
use of com.linkedin.restli.server.annotations.Optional in project rest.li by linkedin.
the class RestLiAnnotationReader method buildPathKeysParam.
private static Parameter<?> buildPathKeysParam(final AnnotationSet annotations, final Class<?> paramType, final Class<?> paramAnnotationType) {
if (!paramType.equals(PathKeys.class)) {
throw new ResourceConfigException("Incorrect data type for param: @" + PathKeysParam.class.getSimpleName() + " or @" + Keys.class.getSimpleName() + " parameter annotation must be of type " + PathKeys.class.getName());
}
Optional optional = annotations.get(Optional.class);
Parameter.ParamType parameter = null;
if (paramAnnotationType.equals(Keys.class)) {
parameter = Parameter.ParamType.PATH_KEYS;
} else if (paramAnnotationType.equals(PathKeysParam.class)) {
parameter = Parameter.ParamType.PATH_KEYS_PARAM;
} else {
throw new ResourceConfigException("Param Annotation type must be 'PathKeysParam' or the deprecated 'Keys' for PathKeys");
}
@SuppressWarnings({ "unchecked", "rawtypes" }) Parameter<?> param = new Parameter("", paramType, null, optional != null, new PathKeysImpl(), parameter, false, annotations);
return param;
}
Aggregations