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

Java ExceptionClass类代码示例

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

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



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

示例1: getDistance

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * getDistance
 * @param geoGrid
 * @return returns the distance between this grid's coordinates
 *           and param grid's coordinates
 * @throws Exception
 */
public Distance getDistance (GeoGrid geoGrid) throws Exception {
  
  if (this.geoGridsConfig.equal(geoGrid.geoGridsConfig) == false) {
    
    throw new CodeException(
      61,
      3,
      "this GeoGrid and param GeoGrid has different configurations, "
      + "can't calculate distance between them",
      ExceptionClass.ARGUMENT);
  }
  
  return this.geoCoordinates.getDistance(
    geoGrid.geoCoordinates,
    this.geoGridsConfig.getDistanceUnitType() );
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:24,代码来源:GeoGrid.java


示例2: getCentersDistance

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * getCentersDistance
 * @param geoGrid
 * @return returns the distance between this grid's center coordinates
 *           and param grid's center coordinates
 * @throws Exception
 */
public Distance getCentersDistance (GeoGrid geoGrid) throws Exception {
  
  if (this.geoGridsConfig.equal(geoGrid.geoGridsConfig) == false) {
    
    throw new CodeException(
      61,
      4,
      "this GeoGrid and param GeoGrid has different configurations, "
      + "can't calculate distance between them",
      ExceptionClass.ARGUMENT);
  }
  
  return this.centerGeoCoordinates.getDistance(
    geoGrid.centerGeoCoordinates,
    this.geoGridsConfig.getDistanceUnitType() );
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:24,代码来源:GeoGrid.java


示例3: SnowFlake

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * Constructor SnowFlake
 * @return new SnowFlake Object
 * @throws Exception
 */
private  SnowFlake () throws Exception {
  
  this.machineId = this.getMachineId();
  
  if (this.machineId > this.maxMachineId || this.machineId < 0) {

    throw new CodeException(
      81,
      2,
      "machineId > maxMachineId (maximum number of allowed instances is ["
      + this.maxMachineId
      + "] )",
      ExceptionClass.UNAUTHORIZED);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:21,代码来源:SnowFlake.java


示例4: Period

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * Constructor Period
 * @param value: number of units (e.g.: 5 seconds)
 * @param unit: e.g.: second, hour, week, etc ...
 * @return new Period Object
 * @throws Exception
 */
public Period (
  double value,
  TimeUnitType unit) {
  
  if (value < 0.0) {
    
    throw new CodeException(
      122,
      5,
      "Period value ["
      + value
      + "] can't be negative",
      ExceptionClass.INVALID);
  }
  
  this.value = value;
  this.unit = unit;
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:26,代码来源:Period.java


示例5: setValue

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * setValue
 * @param value
 */
public void setValue (double value) {
  
  if (value < 0.0) {
    
    throw new CodeException(
      122,
      6,
      "Period value ["
      + value
      + "] can't be negative",
      ExceptionClass.INVALID);
  }
  
  this.value = value;
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:20,代码来源:Period.java


示例6: minus

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * minus
 * @param value
 * @return a new Period Object with this Period's unit and
 *           new value = this value - param value
 * @throws Exception
 */
public Period minus (double value) throws Exception {
  
  if (value > this.value) {
    
    throw new CodeException(
      122,
      7,
      "Period minus operation will lead to a negative Period, that's an "
      + "invalid operation, minus value must be smaller than or equal to "
      + "current value. Current value ["
      + this.value
      + "] minus value ["
      + value
      + "].",
      ExceptionClass.INVALID);
  }
  
  return new Period(this.value - value, this.unit);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:27,代码来源:Period.java


示例7: minus

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * minus
 * @param value
 * @return a new Distance Object with this Distance's unit and
 *           new value = this value - param value
 * @throws Exception
 */
public Distance minus (double value) throws Exception {
  
  if (value > this.value) {
    
    throw new CodeException(
      122,
      1,
      "Distance minus operation will lead to a negative distance, that's an "
      + "invalid operation, minus value must be smaller than or equal to "
      + "current value. Current value ["
      + this.value
      + "] minus value ["
      + value
      + "].",
      ExceptionClass.INVALID);
  }
  
  return new Distance(this.value - value, this.unit);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:27,代码来源:Distance.java


示例8: getResult

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * getResult
 * @return response's body as a play framework Result
 * @throws Exception
 */
@JsonIgnore
public Result getResult () throws Exception {
  
  if (this.getType() == ResponseType.JSON) {
  
    return Results.ok((String)this.getContent() );
  } else if (this.getType() == ResponseType.FILE) {
  
    return Results.ok(new FileInputStream((String)this.getContent() ) );
  } else if (this.getType() == ResponseType.HTML) {
    
    return Results.ok((Content)this.getContent() );
  }
  
  throw new CodeException(
    151,
    12,
    "Unhandled ResponseBody Type ["
    + this.getType().toString()
    + "]",
    ExceptionClass.TYPE);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:28,代码来源:ResponseBody.java


示例9: fromPlayRequest

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * fromPlayRequest
 * converts a play request's body to a new RequestJsonBody Object
 * @param playRequest
 * @return new RequestJsonBody Object
 * @throws Exception
 */
@JsonIgnore
final public RequestJsonBody fromPlayRequest (
  play.mvc.Http.Request playRequest) throws Exception {
  
  if (RequestType.valueOf(playRequest.method().toUpperCase() ) ==
        RequestType.POST) {
    
    return this.fromJsonString(playRequest.body().asJson().toString() );
  } else if (RequestType.valueOf(playRequest.method().toUpperCase() ) ==
      RequestType.GET) {
    
    return this.fromQueryString(playRequest.queryString() );
  }
  
  throw new BadRequestException(
    151,
    8,
    "unhandled request type, only handles POST and GET request types",
    ExceptionClass.TYPE);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:28,代码来源:RequestJsonBody.java


示例10: checkInstanceOf

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * checkInstanceOf
 * @param object: the object to be checked
 * @param type: expected class type
 * @param exceptionType: exception type to throw
 *          (bad request or code exception)
 * @throws VangavException
 * */
public static void checkInstanceOf (
  Object object,
  Class<?> type,
  ExceptionType exceptionType) throws Exception {
  
  if (object.getClass().equals(type) == false) {
    
    throw VangavException.exceptionFactory(
      41,
      1,
      "Wrong class type ["
      + object.getClass().getName()
      + "] expecting ["
      + type.getName()
      + "]",
      exceptionType,
      ExceptionClass.ARGUMENT);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:28,代码来源:ArgumentsInl.java


示例11: checkNotNull

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * checkNotNull
 * @param name: name of the object to be checked
 * @param object: object to be checked
 * @param exceptionType: exception type to throw
 *          (bad request or code exception)
 * @throws VangavException
 * */
public static void checkNotNull (
  String name,
  Object object,
  ExceptionType exceptionType) throws Exception {
  
  if (object == null) {
    
    throw VangavException.exceptionFactory(
      41,
      2,
      name
      + " can't be null",
      exceptionType,
      ExceptionClass.ARGUMENT);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:25,代码来源:ArgumentsInl.java


示例12: checkNotEmpty

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * checkNotEmpty
 * @param name
 * @param string
 * @param exceptionType
 * @throws Exception if param string is null or empty
 */
public static void checkNotEmpty (
  String name,
  String string,
  ExceptionType exceptionType) throws Exception {
  
  checkNotNull(name, string, exceptionType);
  
  if (string.length() == 0) {
    
    throw VangavException.exceptionFactory(
      41,
      3,
      name
      + " can't be empty",
      exceptionType,
      ExceptionClass.ARGUMENT);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:26,代码来源:ArgumentsInl.java


示例13: checkIntWithinRange

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * checkIntWithinRange
 * @param name: name of the integer to be checked
 * @param value: value of the integer to be checked
 * @param min: minimum valid value
 * @param max: maximum valid value
 * @param exceptionType: exception type to throw
 *          (bad request or code exception)
 * @throws VangavException
 * */
public static void checkIntWithinRange (
  String name,
  int value,
  int min,
  int max,
  ExceptionType exceptionType) throws Exception {
  
  if (value < min || value > max) {
    
    throw VangavException.exceptionFactory(
      41,
      12,
      name
      + " value ["
      + value
      + "] min ["
      + min
      + "] max ["
      + max
      + "] is out of range",
      exceptionType,
      ExceptionClass.ARGUMENT);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:35,代码来源:ArgumentsInl.java


示例14: checkIntGreaterThanOrEqual

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * checkIntGreaterThanOrEqual
 * @param name: name of the integer to be checked
 * @param value: value of the integer to be checked
 * @param minLimit: minimum valid value
 * @param exceptionType: exception type to throw
 *          (bad request or code exception)
 * @throws VangavException
 * */
public static void checkIntGreaterThanOrEqual (
  String name,
  int value,
  int minLimit,
  ExceptionType exceptionType) throws Exception {
  
  if (value < minLimit) {
    
    throw VangavException.exceptionFactory(
      41,
      13,
      name
      + " value ["
      + value
      + "] min limit ["
      + minLimit
      + "] is less than the minimum limit",
      exceptionType,
      ExceptionClass.ARGUMENT);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:31,代码来源:ArgumentsInl.java


示例15: checkLongGreaterThanOrEqual

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * checkLongGreaterThanOrEqual
 * @param name: name of the long to be checked
 * @param value: value of the long to be checked
 * @param minLimit: minimum valid value
 * @param exceptionType: exception type to throw
 *          (bad request or code exception)
 * @throws VangavException
 * */
public static void checkLongGreaterThanOrEqual (
  String name,
  long value,
  long minLimit,
  ExceptionType exceptionType) throws Exception {
  
  if (value < minLimit) {
    
    throw VangavException.exceptionFactory(
      41,
      14,
      name
      + " value ["
      + value
      + "] min limit ["
      + minLimit
      + "] is less than the minimum limit",
      exceptionType,
      ExceptionClass.ARGUMENT);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:31,代码来源:ArgumentsInl.java


示例16: checkDoubleHasValue

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * checkDoubleHasValue
 * throws an exception is param value is NAN or infinite
 * @param name
 * @param value
 * @param exceptionType
 * @throws Exception
 */
public static void checkDoubleHasValue (
  String name,
  double value,
  ExceptionType exceptionType) throws Exception {
  
  if (Double.isNaN(value) || Double.isInfinite(value) ) {
   
    throw VangavException.exceptionFactory(
      41,
      15,
      name
      + " double ["
      + value
      + "] has no value",
      exceptionType,
      ExceptionClass.ARGUMENT);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:27,代码来源:ArgumentsInl.java


示例17: getName

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * getName
 * @return the url format String for each each
 * @throws Exception
 */
private String getName () throws Exception {
  
  switch (this) {
    case GAS_STATIONS:
      return "gasstations";
    case OPERATION_AREA:
      return "operationareas";
    case PARKING_SPOTS:
      return "parkingspots";
    case VEHICLES:
      return "vehicles";
    default:
      throw new CodeException(
        153,
        1,
        "Invalid EdgeType ["
          + this.toString()
          + "]",
        ExceptionClass.TYPE);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:27,代码来源:Car2GoApi.java


示例18: getRestResponseJson

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * getRestResponseJson
 * @return a new RestResponseJson Object per edge for storing the API's
 *           fetched data
 * @throws Exception
 */
private RestResponseJson getRestResponseJson () throws Exception {
  
  switch (this) {
    case GAS_STATIONS:
      return new GasStations();
    case OPERATION_AREA:
      return new OperationAreas();
    case PARKING_SPOTS:
      return new ParkingSpots();
    case VEHICLES:
      return new Vehicles();
    default:
      throw new CodeException(
        153,
        2,
        "Invalid EdgeType ["
          + this.toString()
          + "]",
        ExceptionClass.TYPE);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:28,代码来源:Car2GoApi.java


示例19: i

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
/**
 * i
 * @return static singleton instance of AndroidNotificationSender defined
 *           using the values in android_notification_properties.prop
 * @throws Exception
 */
public static AndroidNotificationSender i () throws Exception {
  
  if (instance == null) {
    
    if (AndroidNotificationProperties.i().isDefined() == false) {
      
      throw new CodeException(
        154,
        1,
        "values in ["
        + AndroidNotificationProperties.i().getName()
        + ".prop] aren't defined, either define them or use the normal "
        + "constructor instead",
        ExceptionClass.PROPERTIES);
    }
    
    instance =
      new AndroidNotificationSender(
        AndroidNotificationProperties.i().getStringPropterty(
          AndroidNotificationProperties.kApiKey) );
  }
  
  return instance;
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:31,代码来源:AndroidNotificationSender.java


示例20: validate

import com.vangav.backend.exceptions.VangavException.ExceptionClass; //导入依赖的package包/类
@Override
@JsonIgnore
public void validate () throws Exception {

  this.validate(
    kClassPrefixName,
    this.class_prefix,
    ParamType.ALPHA_NUMERIC_DASH_UNDERSCORE,
    ParamOptionality.MANDATORY);
  this.validate(
    kActionIdName,
    this.action_id,
    ParamType.ALPHA_NUMERIC_DASH_UNDERSCORE,
    ParamOptionality.MANDATORY);

  // more validation
  if (ActionsManager.i().validateActionId(
        this.class_prefix,
        this.action_id) == false) {
    
    throw new BadRequestException(
      501,
      1,
      "Either or both of the class prefix ["
        + this.class_prefix
        + "] and the action id ["
        + this.action_id
        + "] are invalid",
      ExceptionClass.INVALID);
  }
}
 
开发者ID:vangav,项目名称:vos_vangav_analytics_writer,代码行数:32,代码来源:RequestRecordAction.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ApplicationDefaults类代码示例发布时间:2022-05-22
下一篇:
Java GetJournalCTimeResponseProto类代码示例发布时间: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