Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import com.fasterxml.jackson.databind.JsonSerializer;

/**
Expand All @@ -13,6 +14,11 @@ public interface TypeCombinator {
@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@interface TypeCombinatorCase {
/**
* Java type of the object wrapped in the annotated TypeCombinator container.
* @return String encoded java type of the wrapped object
*/
String type() default "";
}

@Retention(RetentionPolicy.RUNTIME)
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/io/apimatic/core/types/AnyOfValidationException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.apimatic.core.types;

import java.io.IOException;
import java.util.List;
import com.fasterxml.jackson.databind.JsonNode;

/**
* This is the base class for all exceptions that represent an error response from the server.
*/
public class AnyOfValidationException extends IOException {

/**
* UID for serialization.
*/
private static final long serialVersionUID = 1214174253911720228L;

/**
* Initialization constructor.
* @param types List on unMapped types
* @param json Value that was not mapped by the above types
*/
public AnyOfValidationException(final List<String> types, final JsonNode json) {
super("We could not match any acceptable type from "
+ String.join(", ", types) + " on: " + json);
}
}
37 changes: 37 additions & 0 deletions src/main/java/io/apimatic/core/types/OneOfValidationException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.apimatic.core.types;

import java.io.IOException;
import java.util.List;
import com.fasterxml.jackson.databind.JsonNode;

/**
* This is the base class for all exceptions that represent an error response from the server.
*/
public class OneOfValidationException extends IOException {

/**
* UID for serialization.
*/
private static final long serialVersionUID = 6424174253911720228L;

/**
* Initialization constructor.
* @param type1 The first type that was mapped on jsonNode
* @param type2 The second type that also got mapped on jsonNode
* @param json Value that was mapped by the above two types
*/
public OneOfValidationException(final String type1, final String type2, final JsonNode json) {
super("There are more than one matching types i.e. "
+ type1 + " and " + type2 + " on: " + json);
}

/**
* Initialization constructor.
* @param types List on unMapped types
* @param json Value that was not mapped by the above types
*/
public OneOfValidationException(final List<String> types, final JsonNode json) {
super("We could not match any acceptable type from "
+ String.join(", ", types) + " on: " + json);
}
}
Loading