-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the use of Gson's internal newParametrizedTypeWithOwner
since this class is an internal one, it can be changed without notice. Replacing this with a simple implementation of ParameterizedType.
- Loading branch information
Showing
2 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/com/suse/salt/netapi/utils/ParameterizedTypeImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.suse.salt.netapi.utils; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
/** Implementation of Java's ParametrizedType for internal use */ | ||
public class ParameterizedTypeImpl implements java.lang.reflect.ParameterizedType { | ||
|
||
private final Type owner; | ||
private final Type raw; | ||
private final Type[] argumentsTypes; | ||
|
||
/** | ||
* Construct a parametrized type | ||
* | ||
* @param ownerIn the ownerIn type | ||
* @param rawTypeIn the raw type | ||
* @param argumentsTypesIn the arguments actual types | ||
*/ | ||
public ParameterizedTypeImpl(Type ownerIn, Type rawTypeIn, Type[] argumentsTypesIn) { | ||
owner = ownerIn; | ||
raw = rawTypeIn; | ||
argumentsTypes = argumentsTypesIn; | ||
} | ||
|
||
/** | ||
* Construct a parametrized type for a single argument | ||
* | ||
* @param ownerIn the ownerIn type | ||
* @param rawTypeIn the raw type | ||
* @param argumentTypeIn the argument actual types | ||
*/ | ||
public ParameterizedTypeImpl(Type ownerIn, Type rawTypeIn, Type argumentTypeIn) { | ||
this(ownerIn, rawTypeIn, new Type[]{argumentTypeIn}); | ||
} | ||
|
||
@Override | ||
public Type[] getActualTypeArguments() { | ||
return argumentsTypes; | ||
} | ||
|
||
@Override | ||
public Type getRawType() { | ||
return raw; | ||
} | ||
|
||
@Override | ||
public Type getOwnerType() { | ||
return owner; | ||
} | ||
} |