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


Java ObjectId.newInstance方法代码示例

本文整理汇总了Java中com.google.ipc.invalidation.external.client.types.ObjectId.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectId.newInstance方法的具体用法?Java ObjectId.newInstance怎么用?Java ObjectId.newInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.ipc.invalidation.external.client.types.ObjectId的用法示例。


在下文中一共展示了ObjectId.newInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getObjectId

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入方法依赖的package包/类
/**
 * Converts the given object id string stored in preferences to an object id.
 * Returns null if the string does not represent a valid object id.
 */
private ObjectId getObjectId(String objectIdString) {
    int separatorPos = objectIdString.indexOf(':');
    // Ensure that the separator is surrounded by at least one character on each side.
    if (separatorPos < 1 || separatorPos == objectIdString.length() - 1) {
        return null;
    }
    int objectSource;
    try {
        objectSource = Integer.parseInt(objectIdString.substring(0, separatorPos));
    } catch (NumberFormatException e) {
        return null;
    }
    byte[] objectName = objectIdString.substring(separatorPos + 1).getBytes();
    return ObjectId.newInstance(objectSource, objectName);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:20,代码来源:InvalidationPreferences.java

示例2: convertFromObjectIdProto

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入方法依赖的package包/类
/**
 * Converts an object id protocol buffer {@code objectId} to the
 * corresponding external type and returns it.
 */
public static ObjectId convertFromObjectIdProto(ObjectIdP objectIdProto) {
  Preconditions.checkNotNull(objectIdProto);
  return ObjectId.newInstance(objectIdProto.getSource(), objectIdProto.getName().getByteArray());
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:9,代码来源:ProtoWrapperConverter.java

示例3: getObjectId

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入方法依赖的package包/类
/** Gets object ID given index. */
private static ObjectId getObjectId(int i) {
  return ObjectId.newInstance(DEMO_SOURCE, (OBJECT_ID_PREFIX + i).getBytes());
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:5,代码来源:ExampleListener.java

示例4: convertFromObjectIdProto

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入方法依赖的package包/类
/**
 * Converts an object id protocol buffer {@code objectId} to the
 * corresponding external type and returns it.
 */
public static ObjectId convertFromObjectIdProto(ObjectIdP objectIdProto) {
  Preconditions.checkNotNull(objectIdProto);
  return ObjectId.newInstance(objectIdProto.getSource(), objectIdProto.getName().toByteArray());
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:ProtoConverter.java

示例5: ParcelableObjectId

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入方法依赖的package包/类
/**
 * Creates a new wrapper and object id by reading data from a parcel.
 */
private ParcelableObjectId(Parcel in) {
  int source = in.readInt();
  byte[] value = in.createByteArray();
  objectId = ObjectId.newInstance(source, value);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:ParcelableObjectId.java

示例6: toObjectId

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入方法依赖的package包/类
/**
 * Converts a notification type into an ObjectId.
 *
 * If the model type is not an invalidation type, this function uses the string "NULL".
 */
private static ObjectId toObjectId(String notificationType) {
    String objectIdString = isInvalidationType(notificationType) ? notificationType : "NULL";
    return ObjectId.newInstance(Types.ObjectSource.CHROME_SYNC, objectIdString.getBytes());
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:ModelTypeHelper.java


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