当前位置: 首页>>代码示例>>Java>>正文


Java Entity类代码示例

本文整理汇总了Java中com.packtpub.mmj.user.domain.model.entity.Entity的典型用法代码示例。如果您正苦于以下问题:Java Entity类的具体用法?Java Entity怎么用?Java Entity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Entity类属于com.packtpub.mmj.user.domain.model.entity包,在下文中一共展示了Entity类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findById

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 * Fetch users with the given id. <code>http://.../v1/users/{id}</code> will
 * return user with given id.
 *
 * @param id
 * @return A non-null, non-empty collection of users.
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@HystrixCommand(fallbackMethod = "defaultUser")
public ResponseEntity<Entity> findById(@PathVariable("id") String id) {
    logger.info(String.format("user-service findById() invoked:%s for %s ", userService.getClass().getName(), id));
    id = id.trim();
    Entity user;
    try {
        user = userService.findById(id);
    } catch (Exception ex) {
        logger.log(Level.WARNING, "Exception raised findById REST Call {0}", ex);
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
    return user != null ? new ResponseEntity<>(user, HttpStatus.OK)
            : new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:23,代码来源:UserController.java

示例2: findById

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 * Fetch users with the given id. <code>http://.../v1/users/{id}</code> will
 * return user with given id.
 *
 * @param id
 * @return A non-null, non-empty collection of users.
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@HystrixCommand(fallbackMethod = "defaultUser")
public ResponseEntity<Entity> findById(@PathVariable("id") String id) {
    logger.info(String.format("user-service findById() invoked:{} for {} ", userService.getClass().getName(), id));
    id = id.trim();
    Entity user;
    try {
        user = userService.findById(id);
    } catch (Exception ex) {
        logger.log(Level.WARNING, "Exception raised findById REST Call {0}", ex);
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
    return user != null ? new ResponseEntity<>(user, HttpStatus.OK)
            : new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:PacktPublishing,项目名称:Microservices-Building-Scalable-Software,代码行数:23,代码来源:UserController.java

示例3: findById

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 * Fetch users with the given id. <code>http://.../v1/users/{id}</code> will
 * return user with given id.
 *
 * @param id
 * @return A non-null, non-empty collection of users.
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<Entity> findById(@PathVariable("id") String id) {
    logger.info(String.format("user-service findById() invoked:{} for {} ", userService.getClass().getName(), id));
    id = id.trim();
    Entity user;
    try {
        user = userService.findById(id);
    } catch (Exception ex) {
        logger.log(Level.WARNING, "Exception raised findById REST Call {0}", ex);
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
    return user != null ? new ResponseEntity<>(user, HttpStatus.OK)
            : new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:22,代码来源:UserController.java

示例4: findById

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 *
 * @param id
 * @return
 * @throws Exception
 */
@Override
public Entity findById(String id) throws Exception {
    return userRepository.get(id);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:11,代码来源:UserServiceImpl.java

示例5: findById

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 *
 * @param id
 * @return
 * @throws Exception
 */
public Entity findById(String id) throws Exception;
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:8,代码来源:UserService.java

示例6: defaultUser

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 * Fallback method
 *
 * @param input
 * @return
 */
public ResponseEntity<Entity> defaultUser(String input) {
    logger.warning("Fallback method for user-service is being used.");
    return new ResponseEntity<>(null, HttpStatus.NO_CONTENT);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:11,代码来源:UserController.java

示例7: findById

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 *
 * @param restaurantId
 * @return
 * @throws Exception
 */
@Override
public Entity findById(String restaurantId) throws Exception {
    return userRepository.get(restaurantId);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:11,代码来源:UserServiceImpl.java

示例8: findById

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 *
 * @param restaurantId
 * @return
 * @throws Exception
 */
public Entity findById(String restaurantId) throws Exception;
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:8,代码来源:UserService.java

示例9: get

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 *
 * @param id
 * @return
 */
@Override
public Entity get(String id) {
    return entities.get(id);
}
 
开发者ID:PacktPublishing,项目名称:Microservices-Building-Scalable-Software,代码行数:10,代码来源:InMemUserRepository.java

示例10: get

import com.packtpub.mmj.user.domain.model.entity.Entity; //导入依赖的package包/类
/**
 *
 * @param id
 * @return
 */
Entity get(T id);
 
开发者ID:PacktPublishing,项目名称:Microservices-Building-Scalable-Software,代码行数:7,代码来源:ReadOnlyRepository.java


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