removed dependence on Google Guice and Google Collections libraries
This commit is contained in:
parent
bf2a0e4e0b
commit
2bcc832ade
|
@ -64,14 +64,6 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Guice: Dependency injection -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.inject</groupId>
|
|
||||||
<artifactId>guice</artifactId>
|
|
||||||
<version>2.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|
|
@ -15,10 +15,9 @@
|
||||||
*/
|
*/
|
||||||
package com.google.gson.webservice.definition;
|
package com.google.gson.webservice.definition;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A generic Map of calls with relative path where the call is available as the key.
|
* A generic Map of calls with relative path where the call is available as the key.
|
||||||
*
|
*
|
||||||
|
@ -29,7 +28,7 @@ import com.google.common.collect.Maps;
|
||||||
public final class CallPathMap<T> {
|
public final class CallPathMap<T> {
|
||||||
|
|
||||||
public static class Builder<T> {
|
public static class Builder<T> {
|
||||||
private final Map<CallPath, T> contents = Maps.newHashMap();
|
private final Map<CallPath, T> contents = new HashMap<CallPath, T>();
|
||||||
private final T nullValue;
|
private final T nullValue;
|
||||||
|
|
||||||
public Builder(T nullValue) {
|
public Builder(T nullValue) {
|
||||||
|
|
|
@ -18,8 +18,6 @@ package com.google.gson.webservice.definition;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of request or response header objects. There is a {@link HeaderMapSpec} associated with the
|
* Map of request or response header objects. There is a {@link HeaderMapSpec} associated with the
|
||||||
* map as well and only those headers are allowed that are consistent with the specification.
|
* map as well and only those headers are allowed that are consistent with the specification.
|
||||||
|
@ -29,7 +27,6 @@ import com.google.inject.Inject;
|
||||||
public final class HeaderMap extends ParamMap {
|
public final class HeaderMap extends ParamMap {
|
||||||
|
|
||||||
public static class Builder extends ParamMap.Builder<HeaderMapSpec> {
|
public static class Builder extends ParamMap.Builder<HeaderMapSpec> {
|
||||||
@Inject
|
|
||||||
public Builder(HeaderMapSpec spec) {
|
public Builder(HeaderMapSpec spec) {
|
||||||
super(spec);
|
super(spec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,10 @@
|
||||||
package com.google.gson.webservice.definition;
|
package com.google.gson.webservice.definition;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specification of a header map for {@link HeaderMap}.
|
* Specification of a header map for {@link HeaderMap}.
|
||||||
*
|
*
|
||||||
|
@ -29,7 +28,7 @@ import com.google.common.collect.Maps;
|
||||||
public final class HeaderMapSpec implements ParamMapSpec {
|
public final class HeaderMapSpec implements ParamMapSpec {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private final Map<String, Type> map = Maps.newLinkedHashMap();
|
private final Map<String, Type> map = new LinkedHashMap<String, Type>();
|
||||||
|
|
||||||
public void put(String headerName, Type headerType) {
|
public void put(String headerName, Type headerType) {
|
||||||
map.put(headerName, headerType);
|
map.put(headerName, headerType);
|
||||||
|
|
|
@ -1,16 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010 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.gson.webservice.definition;
|
package com.google.gson.webservice.definition;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
class ParamMap {
|
class ParamMap {
|
||||||
|
|
||||||
public static class Builder<T extends ParamMapSpec> {
|
public static class Builder<T extends ParamMapSpec> {
|
||||||
protected final Map<String, Object> contents = Maps.newLinkedHashMap();
|
protected final Map<String, Object> contents = new LinkedHashMap<String, Object>();
|
||||||
protected final T spec;
|
protected final T spec;
|
||||||
|
|
||||||
public Builder(T spec) {
|
public Builder(T spec) {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010 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.gson.webservice.definition;
|
||||||
|
|
||||||
|
final class Preconditions {
|
||||||
|
|
||||||
|
public static void checkArgument(boolean condition) {
|
||||||
|
if (!condition) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkNotNull(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,8 +18,6 @@ package com.google.gson.webservice.definition;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition of the request body of a {@link WebServiceCall}. The request body is what is sent out
|
* Definition of the request body of a {@link WebServiceCall}. The request body is what is sent out
|
||||||
* in the output stream of the request (for example, with
|
* in the output stream of the request (for example, with
|
||||||
|
@ -32,7 +30,6 @@ public final class RequestBody extends ContentBody {
|
||||||
|
|
||||||
public static class Builder extends ParamMap.Builder<RequestBodySpec> {
|
public static class Builder extends ParamMap.Builder<RequestBodySpec> {
|
||||||
|
|
||||||
@Inject
|
|
||||||
public Builder(RequestBodySpec spec) {
|
public Builder(RequestBodySpec spec) {
|
||||||
super(spec);
|
super(spec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
package com.google.gson.webservice.definition;
|
package com.google.gson.webservice.definition;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specification of a {@link RequestBody}.
|
* Specification of a {@link RequestBody}.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +27,7 @@ import com.google.common.collect.Maps;
|
||||||
public final class RequestBodySpec extends ContentBodySpec {
|
public final class RequestBodySpec extends ContentBodySpec {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private final Map<String, Type> paramsSpec = Maps.newLinkedHashMap();
|
private final Map<String, Type> paramsSpec = new LinkedHashMap<String, Type>();
|
||||||
public Builder add(String paramName, Type type) {
|
public Builder add(String paramName, Type type) {
|
||||||
paramsSpec.put(paramName, type);
|
paramsSpec.put(paramName, type);
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package com.google.gson.webservice.definition;
|
package com.google.gson.webservice.definition;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specification for a {@link WebServiceRequest}.
|
* Specification for a {@link WebServiceRequest}.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@ package com.google.gson.webservice.definition;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* body of the response. This is written out as JSON to be sent out to the client.
|
* body of the response. This is written out as JSON to be sent out to the client.
|
||||||
*
|
*
|
||||||
|
@ -29,7 +27,6 @@ public final class ResponseBody extends ContentBody {
|
||||||
|
|
||||||
public static class Builder extends ParamMap.Builder<ResponseBodySpec> {
|
public static class Builder extends ParamMap.Builder<ResponseBodySpec> {
|
||||||
|
|
||||||
@Inject
|
|
||||||
public Builder(ResponseBodySpec spec) {
|
public Builder(ResponseBodySpec spec) {
|
||||||
super(spec);
|
super(spec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
package com.google.gson.webservice.definition;
|
package com.google.gson.webservice.definition;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specification of a {@link ResponseBody}.
|
* Specification of a {@link ResponseBody}.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +27,7 @@ import com.google.common.collect.Maps;
|
||||||
public final class ResponseBodySpec extends ContentBodySpec {
|
public final class ResponseBodySpec extends ContentBodySpec {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private final Map<String, Type> paramsSpec = Maps.newLinkedHashMap();
|
private final Map<String, Type> paramsSpec = new LinkedHashMap<String, Type>();
|
||||||
public Builder add(String paramName, Type type) {
|
public Builder add(String paramName, Type type) {
|
||||||
paramsSpec.put(paramName, type);
|
paramsSpec.put(paramName, type);
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package com.google.gson.webservice.definition;
|
package com.google.gson.webservice.definition;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specification for a {@link WebServiceResponse}.
|
* Specification for a {@link WebServiceResponse}.
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,8 +20,6 @@ import java.util.Arrays;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specification for a Json web service call. The call includes the relative path where the call
|
* Specification for a Json web service call. The call includes the relative path where the call
|
||||||
|
|
Loading…
Reference in New Issue
Block a user