Removing unused ticl.ProtoWrapper class and moving example code
git-svn-id: http://google-cache-invalidation-api.googlecode.com/svn/trunk/src@337 1cc9d426-c294-39be-ba72-c0199ca0f247
diff --git a/example-app-build/generate_protos.sh b/example-app-build/generate_protos.sh
index b7461f8..d6ce93d 100755
--- a/example-app-build/generate_protos.sh
+++ b/example-app-build/generate_protos.sh
@@ -18,5 +18,5 @@
TOOL=${PROTOC- `which protoc`}
mkdir -p generated-protos/
$TOOL --javanano_out=optional_field_style=reftypes:generated-protos/ ../proto/* --proto_path=../proto/
-EXAMPLE_PATH=../java/com/google/ipc/invalidation/examples/android2
+EXAMPLE_PATH=../javaexample/com/google/ipc/invalidation/examples/android2
$TOOL --java_out=generated-protos/ $EXAMPLE_PATH/example_listener.proto --proto_path=$EXAMPLE_PATH
diff --git a/java/com/google/ipc/invalidation/ticl/ProtoWrapper.java b/java/com/google/ipc/invalidation/ticl/ProtoWrapper.java
deleted file mode 100644
index 99e435d..0000000
--- a/java/com/google/ipc/invalidation/ticl/ProtoWrapper.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.ipc.invalidation.ticl;
-
-import com.google.common.base.Preconditions;
-import com.google.protobuf.AbstractMessageLite;
-
-import java.util.Arrays;
-
-/**
- * Wraps a Lite protobuf type and provides appropriate {@link #equals} and {@link #hashCode}
- * implementations so the wrapped object can be stored in a Java collection and/or compared to other
- * wrapped proto instances of the same type for equality. This is necessary because protobuf classes
- * generated with the {@code LITE_RUNTIME} optimization do not have custom implementations of these
- * methods (so only support simple object equivalence).
- *
- * @param <P> the protobuf message lite type that is being wrapped.
- */
-public class ProtoWrapper<P extends AbstractMessageLite> {
-
- /** The wrapped proto object */
- private final P proto;
-
- /** The serialized byte representation of the wrapped object */
- private final byte [] protoBytes;
-
- /** The hash code of the serialized representation */
- private final int hashCode;
-
- /** Returns a ProtoWrapper that wraps the provided object */
- public static <M extends AbstractMessageLite> ProtoWrapper<M> of(M proto) {
- return new ProtoWrapper<M>(proto);
- }
-
- // Internal constructor that savees the object and computes serialized state and hash code.
- private ProtoWrapper(P proto) {
- this.proto = Preconditions.checkNotNull(proto);
- this.protoBytes = proto.toByteArray();
- this.hashCode = Arrays.hashCode(protoBytes);
- }
-
- /** Returns the wrapped proto object */
- public P getProto() {
- return proto;
- }
-
- /** Returns the hash code of the serialized state representation of the protobuf object */
- @Override
- public int hashCode() {
- return hashCode;
- }
-
- /**
- * Returns {@code true} if the provided object is a proto wrapper of an object of the same
- * protobuf type that has the same serialized state representation.
- */
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof ProtoWrapper)) {
- return false;
- }
- @SuppressWarnings("rawtypes")
- ProtoWrapper<?> wrapper = (ProtoWrapper) o;
- if (proto.getClass() != wrapper.proto.getClass()) {
- return false;
- }
- if (hashCode != wrapper.hashCode) {
- return false;
- }
- return Arrays.equals(protoBytes, wrapper.protoBytes);
- }
-
- @Override
- public String toString() {
- // Don't print exactly the protocol buffer because that could be extremely confusing when
- // debugging, since this object isn't actually a protocol buffer.
- return "PW-" + proto;
- }
-}
diff --git a/java/com/google/ipc/invalidation/examples/android2/ExampleListener.java b/javaexample/com/google/ipc/invalidation/examples/android2/ExampleListener.java
similarity index 100%
rename from java/com/google/ipc/invalidation/examples/android2/ExampleListener.java
rename to javaexample/com/google/ipc/invalidation/examples/android2/ExampleListener.java
diff --git a/java/com/google/ipc/invalidation/examples/android2/ExampleListenerState.java b/javaexample/com/google/ipc/invalidation/examples/android2/ExampleListenerState.java
similarity index 100%
rename from java/com/google/ipc/invalidation/examples/android2/ExampleListenerState.java
rename to javaexample/com/google/ipc/invalidation/examples/android2/ExampleListenerState.java
diff --git a/java/com/google/ipc/invalidation/examples/android2/MainActivity.java b/javaexample/com/google/ipc/invalidation/examples/android2/MainActivity.java
similarity index 100%
rename from java/com/google/ipc/invalidation/examples/android2/MainActivity.java
rename to javaexample/com/google/ipc/invalidation/examples/android2/MainActivity.java
diff --git a/java/com/google/ipc/invalidation/examples/android2/example_listener.proto b/javaexample/com/google/ipc/invalidation/examples/android2/example_listener.proto
similarity index 100%
rename from java/com/google/ipc/invalidation/examples/android2/example_listener.proto
rename to javaexample/com/google/ipc/invalidation/examples/android2/example_listener.proto