本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
示例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());
}