本文整理汇总了Java中com.google.protos.ipc.invalidation.AndroidService.ListenerUpcall.ErrorUpcall类的典型用法代码示例。如果您正苦于以下问题:Java ErrorUpcall类的具体用法?Java ErrorUpcall怎么用?Java ErrorUpcall使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorUpcall类属于com.google.protos.ipc.invalidation.AndroidService.ListenerUpcall包,在下文中一共展示了ErrorUpcall类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasField
import com.google.protos.ipc.invalidation.AndroidService.ListenerUpcall.ErrorUpcall; //导入依赖的package包/类
/** Returns whether {@code field} is present in {@code message}. */
@Override
@SuppressWarnings("unchecked")
public boolean hasField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
ErrorUpcall message = (ErrorUpcall) rawMessage;
if (field == ERROR_CODE) {
return message.hasErrorCode();
}
if (field == ERROR_MESSAGE) {
return message.hasErrorMessage();
}
if (field == IS_TRANSIENT) {
return message.hasIsTransient();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例2: getField
import com.google.protos.ipc.invalidation.AndroidService.ListenerUpcall.ErrorUpcall; //导入依赖的package包/类
/** Returns the {@code field} from {@code message}. */
@Override
@SuppressWarnings("unchecked")
public Object getField(MessageLite rawMessage, Descriptor field) {
Preconditions.checkNotNull(rawMessage);
Preconditions.checkNotNull(field);
ErrorUpcall message = (ErrorUpcall) rawMessage;
if (field == ERROR_CODE) {
return message.getErrorCode();
}
if (field == ERROR_MESSAGE) {
return message.getErrorMessage();
}
if (field == IS_TRANSIENT) {
return message.getIsTransient();
}
throw new IllegalArgumentException("Bad descriptor: " + field);
}
示例3: newErrorIntent
import com.google.protos.ipc.invalidation.AndroidService.ListenerUpcall.ErrorUpcall; //导入依赖的package包/类
public static Intent newErrorIntent(ErrorInfo errorInfo) {
Intent intent = new Intent();
ErrorUpcall errorUpcall = ErrorUpcall.newBuilder()
.setErrorCode(errorInfo.getErrorReason())
.setErrorMessage(errorInfo.getErrorMessage())
.setIsTransient(errorInfo.isTransient())
.build();
intent.putExtra(LISTENER_UPCALL_KEY,
newBuilder().setError(errorUpcall).build().toByteArray());
return intent;
}
示例4: toCompactString
import com.google.protos.ipc.invalidation.AndroidService.ListenerUpcall.ErrorUpcall; //导入依赖的package包/类
/** Appends a description of the given {@code error} upcall to the given {@code builder}. */
public static TextBuilder toCompactString(TextBuilder builder, ErrorUpcall error) {
if (error == null) {
return builder;
}
return builder.append("error(code = ").append(error.getErrorCode()).append(", message = ")
.append(error.getErrorMessage()).append(", isTransient = ").append(error.getIsTransient())
.append(")");
}
示例5: handleIntent
import com.google.protos.ipc.invalidation.AndroidService.ListenerUpcall.ErrorUpcall; //导入依赖的package包/类
/**
* Handles a listener upcall by decoding the protocol buffer in {@code intent} and dispatching
* to the appropriate method on the {@link #listener}.
*/
public void handleIntent(Intent intent) {
// TODO: use wakelocks
// Unmarshall the arguments from the Intent and make the appropriate call on the listener.
ListenerUpcall upcall = tryParseIntent(intent);
if (upcall == null) {
return;
}
if (upcall.hasReady()) {
listener.ready(client);
} else if (upcall.hasInvalidate()) {
// Handle all invalidation-related upcalls on a common path, since they require creating
// an AckHandleP.
onInvalidateUpcall(upcall, listener);
} else if (upcall.hasRegistrationStatus()) {
RegistrationStatusUpcall regStatus = upcall.getRegistrationStatus();
listener.informRegistrationStatus(client,
ProtoConverter.convertFromObjectIdProto(regStatus.getObjectId()),
regStatus.getIsRegistered() ?
RegistrationState.REGISTERED : RegistrationState.UNREGISTERED);
} else if (upcall.hasRegistrationFailure()) {
RegistrationFailureUpcall failure = upcall.getRegistrationFailure();
listener.informRegistrationFailure(client,
ProtoConverter.convertFromObjectIdProto(failure.getObjectId()),
failure.getTransient(),
failure.getMessage());
} else if (upcall.hasReissueRegistrations()) {
ReissueRegistrationsUpcall reissueRegs = upcall.getReissueRegistrations();
listener.reissueRegistrations(client, reissueRegs.getPrefix().toByteArray(),
reissueRegs.getLength());
} else if (upcall.hasError()) {
ErrorUpcall error = upcall.getError();
ErrorInfo errorInfo = ErrorInfo.newInstance(error.getErrorCode(), error.getIsTransient(),
error.getErrorMessage(), null);
listener.informError(client, errorInfo);
} else {
logger.warning("Dropping listener Intent with unknown call: %s", upcall);
}
}