• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Nullable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.api.server.spi.config.Nullable的典型用法代码示例。如果您正苦于以下问题:Java Nullable类的具体用法?Java Nullable怎么用?Java Nullable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Nullable类属于com.google.api.server.spi.config包,在下文中一共展示了Nullable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testParameterAnnotations

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@Test
public void testParameterAnnotations() throws Exception {
  @Api
  class Endpoint {
    @SuppressWarnings("unused")
    public void method(@Named("foo") @Nullable @DefaultValue("4") int foo) {}
  }

  ApiConfig config = createConfig(Endpoint.class);
  annotationReader.loadEndpointClass(serviceContext, Endpoint.class, config);
  annotationReader.loadEndpointMethods(serviceContext, Endpoint.class,
      config.getApiClassConfig().getMethods());

  ApiMethodConfig methodConfig =
      Iterables.getOnlyElement(config.getApiClassConfig().getMethods().values());
  ApiParameterConfig parameterConfig =
      Iterables.getOnlyElement(methodConfig.getParameterConfigs());
  validateParameter(parameterConfig, "foo", true, "4", int.class, null, int.class);
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:20,代码来源:ApiConfigAnnotationReaderTest.java


示例2: testParameterAnnotations_javax

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@Test
public void testParameterAnnotations_javax() throws Exception {
  @Api
  class Endpoint {
    @SuppressWarnings("unused")
    public void method(@javax.inject.Named("foo") @javax.annotation.Nullable int foo) {}
  }

  ApiConfig config = createConfig(Endpoint.class);
  annotationReader.loadEndpointClass(serviceContext, Endpoint.class, config);
  annotationReader.loadEndpointMethods(serviceContext, Endpoint.class,
      config.getApiClassConfig().getMethods());

  ApiMethodConfig methodConfig =
      Iterables.getOnlyElement(config.getApiClassConfig().getMethods().values());
  ApiParameterConfig parameterConfig =
      Iterables.getOnlyElement(methodConfig.getParameterConfigs());
  validateParameter(parameterConfig, "foo", true, null, int.class, null, int.class);
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:20,代码来源:ApiConfigAnnotationReaderTest.java


示例3: echo

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(
        name = "echo",
        path = "echo",
        httpMethod = ApiMethod.HttpMethod.GET)
/* >>>>>>>>>>>>>> this is for testing only
* curl -H "Content-Type: application/json" -X GET -d '{"message":"hello world"}' https://cryptonomica-server.appspot.com/_ah/api/userSearchAndViewAPI/v1/echo
* */
public StringWrapperObject echo(
        @Named("message") String message,
        @Named("n") @Nullable Integer n
) {
    StringWrapperObject stringWrapperObject = new StringWrapperObject();

    if (n != null && n >= 0) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(message);
        }
        stringWrapperObject.setMessage(sb.toString());
    }
    return stringWrapperObject;
}
 
开发者ID:Cryptonomica,项目名称:cryptonomica,代码行数:26,代码来源:UserSearchAndViewAPI.java


示例4: createHIT

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "createHIT", path = "createHIT/{surveyId}", httpMethod = HttpMethod.POST)
public StringResponse createHIT(@Named("surveyId") String surveyId,
        @Nullable @Named("production") Boolean production, User user)
        throws InternalServerErrorException, NotFoundException, UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        Survey survey = surveyService.get(surveyId);
        if(survey == null) {
            throw new NotFoundException(String.format("Survey %s doesn't exist", surveyId));
        }
        HIT hit = createHITService.createHIT(production, survey);
        return new StringResponse(String.format("created HIT with id: %s", hit.getHITId()));
    } catch (MturkException e) {
        logger.log(Level.SEVERE, "Error creating HIT", e);
        throw new InternalServerErrorException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:18,代码来源:MturkEndpoint.java


示例5: list

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(
	name = "task.list",
	path = "task",
	httpMethod = HttpMethod.GET
)
public List<Task> list(com.google.appengine.api.users.User gUser, @Nullable @Named("project") String projectId, @Nullable @Named("user") String userId) throws OAuthRequestException, UnauthorizedException, EntityNotFoundException {
	userService.ensureEnabled(gUser);
	
	if (projectId != null && userId == null)
		return taskService.list(projectId);
	else if (projectId == null && userId != null) {
		User assignee = userService.get(userId);
		if (assignee == null) throw new EntityNotFoundException("User "+userId+" not found");
		return taskService.listToDoForUser(assignee);
	} else if (projectId == null && userId == null) {
		return taskService.list();
	} else {
		throw new IllegalArgumentException("Please, specify only one of project or user, not both");
	}
		
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:22,代码来源:TaskEndpoint.java


示例6: list

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(
	name = "user.list",
	path = "user",
	httpMethod = HttpMethod.GET
)
public List<User> list(@Named("project") @Nullable String projectId, @Named("q") @Nullable String q, com.google.appengine.api.users.User gUser) throws OAuthRequestException, UnauthorizedException {
	userService.ensureEnabled(gUser);
	
	if (projectId != null && q == null) {
		Project project = ProjectService.getInstance().get(projectId);
		Ref2EntityTransformer<User> t = new Ref2EntityTransformer<User>();
		return t.transformTo(project.getUsers());
	} else if (projectId == null && q != null) {
		return q.equals("") ? UserService.getInstance().list(3) : UserService.getInstance().search(q,3);
	} else {
		return UserService.getInstance().list();
	}
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:19,代码来源:UserEndpoint.java


示例7: execute0

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(
    name = "foos.execute0",
    path = "execute0",
    httpMethod = "POST"
)
public Object execute0(@Named("id") String id, @Named("i0") int i0,
    @Named("i1") @Nullable Integer i1, @Named("long0") long long0,
    @Nullable @Named("long1") Long long1, @Named("b0") boolean b0,
    @Nullable @Named("b1") Boolean b1, @Named("f") float f,
    @Nullable @Named("d") Double d) {
  return null;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:13,代码来源:Endpoint1.java


示例8: listQuote

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "listUsers")
public CollectionResponse<Users> listQuote(@Nullable @com.google.api.server.spi.config.Named("cursor") String cursorString,
                                           @Nullable @com.google.api.server.spi.config.Named("count") Integer count) {

    Query<Users> query = ofy().load().type(Users.class);
    if (count != null) query.limit(count);
    if (cursorString != null && cursorString != "") {
        query = query.startAt(Cursor.fromWebSafeString(cursorString));
    }
    List<Users> records = new ArrayList<Users>();
    QueryResultIterator<Users> iterator = query.iterator();
    int num = 0;
    while (iterator.hasNext()) {
        records.add(iterator.next());
        if (count != null) {
            num++;
            if (num == count) break;
        }
    }
    //Find the next cursor
    if (cursorString != null && cursorString != "") {
        Cursor cursor = iterator.getCursor();
        if (cursor != null) {
            cursorString = cursor.toWebSafeString();
        }
    }
    return CollectionResponse.<Users>builder().setItems(records).setNextPageToken(cursorString).build();
}
 
开发者ID:LavanyaGanganna,项目名称:Capstoneproject1,代码行数:29,代码来源:MyEndpoint.java


示例9: orderlist

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(
        name = "orderlist",
        httpMethod = ApiMethod.HttpMethod.GET)
public List<Orders> orderlist(@javax.annotation.Nullable @Named("cursor") String cursor){
    Query<Orders> query = ofy().load().type(Orders.class).limit(1000);
    if (cursor != null)
        query = query.startAt(Cursor.fromWebSafeString(cursor));
    QueryResultIterator<Orders> queryIterator = query.iterator();
    List<Orders> ordersList = new ArrayList<Orders>(1000);
    while (queryIterator.hasNext()) {
        ordersList.add(queryIterator.next());
    }
    return ordersList;
}
 
开发者ID:LavanyaGanganna,项目名称:Capstoneproject1,代码行数:15,代码来源:MyEndpoint.java


示例10: getHIT

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "getHIT", path = "getHIT/{id}", httpMethod = HttpMethod.GET)
public HIT getHIT(@Named("id") String id, @Nullable @Named("production") Boolean production,
        User user) throws BadRequestException, UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        return getHITService.getHIT(production, id);
    } catch (MturkException e) {
        throw new BadRequestException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:11,代码来源:MturkEndpoint.java


示例11: searhHITs

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "searhHITs", path = "searhHITs", httpMethod = HttpMethod.GET)
public List<HIT> searhHITs(@Nullable @Named("production") Boolean production,
        User user) throws BadRequestException, UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        return searchHITsService.searchHITs(production);
    } catch (MturkException e) {
        throw new BadRequestException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:11,代码来源:MturkEndpoint.java


示例12: disableHIT

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "disableHIT", path = "disableHIT/{id}", httpMethod = HttpMethod.GET)
public StringResponse disableHIT(@Named("id") String id,
        @Nullable @Named("production") Boolean production, User user)
        throws BadRequestException, UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        disableHITService.disableHIT(production, id);
        return new StringResponse(String.format("HIT %s disabled successfully", id));
    } catch (MturkException e) {
        throw new BadRequestException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:13,代码来源:MturkEndpoint.java


示例13: disposeHIT

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "disposeHIT", path = "disposeHIT/{id}", httpMethod = HttpMethod.GET)
public StringResponse disposeHIT(@Named("id") String id,
        @Nullable @Named("production") Boolean production, User user)
        throws BadRequestException, UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        disposeHITService.disposeHIT(production, id);
        return new StringResponse(String.format("HIT %s disposed successfully", id));
    } catch (MturkException e) {
        throw new BadRequestException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:13,代码来源:MturkEndpoint.java


示例14: getBalance

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "getBalance", path = "getBalance", httpMethod = HttpMethod.GET)
public StringResponse getBalance(@Nullable @Named("production") Boolean production,
        User user) throws BadRequestException, UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        return new StringResponse(String.format("Your balance: %.2f", getAccountBalanceService.getBalance(production)));
    } catch (MturkException e) {
        throw new BadRequestException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:11,代码来源:MturkEndpoint.java


示例15: getAssignmentsForHIT

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "getAssignmentsForHIT", path = "getAssignmentsForHIT/{hitId}", httpMethod = HttpMethod.GET)
public List<Assignment> getAssignmentsForHIT(@Named("hitId") String hitId,
        @Nullable @Named("production") Boolean production, User user) throws BadRequestException,
        UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        return getAssignmentsForHITService.getAssignments(production, hitId);
    } catch (MturkException e) {
        throw new BadRequestException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:12,代码来源:MturkEndpoint.java


示例16: approveAssignment

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "approveAssignment", path = "approveAssignment/{assignmentId}", httpMethod = HttpMethod.GET)
public StringResponse approveAssignment(@Named("assignmentId") String assignmentId, 
        @Nullable @Named("production") Boolean production, User user) throws BadRequestException,
        UnauthorizedException {
    Security.verifyAuthenticatedUser(user);
    try {
        approveAssignmentService.approveAssignment(production, assignmentId);
        return new StringResponse(String.format("Assignment %s approved successfully", assignmentId));
    } catch (MturkException e) {
        throw new BadRequestException(e.getMessage(), e);
    }
}
 
开发者ID:ipeirotis,项目名称:mturk-surveys,代码行数:13,代码来源:MturkEndpoint.java


示例17: listTestReports

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
/**
 * Returns the {@link com.google.appengine.tck.site.endpoints.TestReport} with the given build type id ordered by
 * build id in the descendant order.
 *
 * @param buildTypeId the build type id.
 * @param limit       the optional fetch limit, by default {@link com.google.appengine.tck.site.endpoints.TestReport#DEFAULT_FETCH_LIMIT}.
 * @return the matching test reports list or an empty one if none.
 */
@ApiMethod(
        name = "tests.list",
        path = "{buildTypeId}/tests",
        httpMethod = GET
)
public List<TestReport> listTestReports(@Named("buildTypeId") String buildTypeId, @Nullable @Named("limit") Integer limit) {
    return TestReport.findByBuildTypeIdOrderByBuildIdDesc(buildTypeId, Optional.fromNullable(limit), this);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:17,代码来源:Reports.java


示例18: param

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(name = "param", path = "param/{parent}/{child}")
public void param(
    @Named("parent") String parent,
    @Named("query") @Nullable String query,
    @Named("child") String child) { }
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:6,代码来源:MultipleParameterEndpoint.java


示例19: tryFindDefaultSerializers

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
private List<Class<? extends Transformer<?, ?>>> tryFindDefaultSerializers(
    @Nullable TypeToken<?> type) {
  ApiSerializationConfig serializerConfig =
      apiMethodConfig.getApiClassConfig().getApiConfig().getSerializationConfig();
  return Serializers.getSerializerClasses(type, serializerConfig);
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:7,代码来源:ApiParameterConfig.java


示例20: setCondiments

import com.google.api.server.spi.config.Nullable; //导入依赖的package包/类
@ApiMethod(path = "sugars/{sugar}")
public void setCondiments(@Nullable @Named("sugar") String item) {
  condiments.add(item);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:5,代码来源:test.java



注:本文中的com.google.api.server.spi.config.Nullable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LimitedFPSEngine类代码示例发布时间:2022-05-22
下一篇:
Java ShardRouting类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap