// Path: meta/src/main/java/tech/anima/tinytypes/meta/MetaTinyType.java
// public interface MetaTinyType<T> {
// 
//     /**
//      * Checks whether this implementation can operate on the given TinyType
//      * class type.
//      *
//      * @param candidate the TInyType type to check for compatibility
//      * @return true if the candidate is supported, false otherwise
//      */
//     boolean isMetaOf(Class<?> candidate);
// 
//     /**
//      * Returns a String representation of the value wrapped in the given
//      * TinyType. The given TinyType must be compatible with this meta.
//      *
//      * @param value the TinyType to stringify
//      * @return a String representation of the native value wrapped in the
//      * TinyType
//      */
//     String stringify(T value);
// 
//     /**
//      * Creates a new instance of the given TinyType class type, wrapping the
//      * given value. The given TinyType class type and the type of value must
//      * both be compatible with this meta.
//      *
//      * @param <U> the TinyType class type to construct
//      * @param type the TinyType class type to construct
//      * @param value the native value to wrap
//      * @return a new instance of U wrapping the given value
//      */
//     <U extends T> U newInstance(Class<U> type, Object value);
// 
//     /**
//      * Creates a new instance of the given TinyType class type, wrapping the
//      * given value given in string form. The given TinyType class type must be
//      * compatible with this meta, the given String value must be parseable as
//      * the appropriate native type.
//      *
//      * @param <U> the TinyType class type to construct
//      * @param type the TinyType class type to construct
//      * @param value the native value to wrap
//      * @return a new instance of U wrapping the given value
//      */
//     <U extends T> U fromString(Class<U> type, String value);
// }
// 
// Path: meta/src/main/java/tech/anima/tinytypes/meta/MetaTinyTypes.java
// public abstract class MetaTinyTypes {
// 
//     public static final MetaTinyType[] metas = new MetaTinyType[]{
//         new StringTinyTypes(),
//         new BooleanTinyTypes(),
//         new ByteTinyTypes(),
//         new ShortTinyTypes(),
//         new IntTinyTypes(),
//         new LongTinyTypes()
//     };
// 
//     /**
//      * Provides a type-specific Meta class for the given TinyType.
//      *
//      * @param <T> the TinyType class type
//      * @param candidate the TinyType class to obtain a Meta for
//      * @return a Meta implementation suitable for the candidate
//      * @throws IllegalArgumentException for null or a non-TinyType
//      */
//     public static <T> MetaTinyType<T> metaFor(Class<?> candidate) {
//         for (MetaTinyType meta : metas) {
//             if (meta.isMetaOf(candidate)) {
//                 return meta;
//             }
//         }
//         throw new IllegalArgumentException(String.format("not a tinytype: %s", candidate == null ? "null" : candidate.getCanonicalName()));
//     }
// 
//     /**
//      * Checks whether a class is a TinyType. A class is considered a TinyType if
//      * is a direct ancestor of a tech.anima.tinytypes.*TinyType, is not abstract
//      * and provides a ctor matching super.
//      *
//      * @param candidate the class to be checked
//      * @return true if the candidate is a TinyType, false otherwise.
//      */
//     public static boolean isTinyType(Class<?> candidate) {
//         for (MetaTinyType meta : metas) {
//             if (meta.isMetaOf(candidate)) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
// }


import javax.ws.rs.ext.Provider;
import tech.anima.tinytypes.meta.MetaTinyType;
import tech.anima.tinytypes.meta.MetaTinyTypes;
import org.glassfish.jersey.spi.HeaderDelegateProvider;
package tech.anima.tinytypes.jersey;


@Provider
public class TinyTypesHeaderDelegateProvider<T> implements HeaderDelegateProvider<T> {

    private final Class<T> type;
// Path: meta/src/main/java/tech/anima/tinytypes/meta/MetaTinyType.java
// public interface MetaTinyType<T> {
// 
//     /**
//      * Checks whether this implementation can operate on the given TinyType
//      * class type.
//      *
//      * @param candidate the TInyType type to check for compatibility
//      * @return true if the candidate is supported, false otherwise
//      */
//     boolean isMetaOf(Class<?> candidate);
// 
//     /**
//      * Returns a String representation of the value wrapped in the given
//      * TinyType. The given TinyType must be compatible with this meta.
//      *
//      * @param value the TinyType to stringify
//      * @return a String representation of the native value wrapped in the
//      * TinyType
//      */
//     String stringify(T value);
// 
//     /**
//      * Creates a new instance of the given TinyType class type, wrapping the
//      * given value. The given TinyType class type and the type of value must
//      * both be compatible with this meta.
//      *
//      * @param <U> the TinyType class type to construct
//      * @param type the TinyType class type to construct
//      * @param value the native value to wrap
//      * @return a new instance of U wrapping the given value
//      */
//     <U extends T> U newInstance(Class<U> type, Object value);
// 
//     /**
//      * Creates a new instance of the given TinyType class type, wrapping the
//      * given value given in string form. The given TinyType class type must be
//      * compatible with this meta, the given String value must be parseable as
//      * the appropriate native type.
//      *
//      * @param <U> the TinyType class type to construct
//      * @param type the TinyType class type to construct
//      * @param value the native value to wrap
//      * @return a new instance of U wrapping the given value
//      */
//     <U extends T> U fromString(Class<U> type, String value);
// }
// 
// Path: meta/src/main/java/tech/anima/tinytypes/meta/MetaTinyTypes.java
// public abstract class MetaTinyTypes {
// 
//     public static final MetaTinyType[] metas = new MetaTinyType[]{
//         new StringTinyTypes(),
//         new BooleanTinyTypes(),
//         new ByteTinyTypes(),
//         new ShortTinyTypes(),
//         new IntTinyTypes(),
//         new LongTinyTypes()
//     };
// 
//     /**
//      * Provides a type-specific Meta class for the given TinyType.
//      *
//      * @param <T> the TinyType class type
//      * @param candidate the TinyType class to obtain a Meta for
//      * @return a Meta implementation suitable for the candidate
//      * @throws IllegalArgumentException for null or a non-TinyType
//      */
//     public static <T> MetaTinyType<T> metaFor(Class<?> candidate) {
//         for (MetaTinyType meta : metas) {
//             if (meta.isMetaOf(candidate)) {
//                 return meta;
//             }
//         }
//         throw new IllegalArgumentException(String.format("not a tinytype: %s", candidate == null ? "null" : candidate.getCanonicalName()));
//     }
// 
//     /**
//      * Checks whether a class is a TinyType. A class is considered a TinyType if
//      * is a direct ancestor of a tech.anima.tinytypes.*TinyType, is not abstract
//      * and provides a ctor matching super.
//      *
//      * @param candidate the class to be checked
//      * @return true if the candidate is a TinyType, false otherwise.
//      */
//     public static boolean isTinyType(Class<?> candidate) {
//         for (MetaTinyType meta : metas) {
//             if (meta.isMetaOf(candidate)) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
// }


// Path: jersey/src/main/java/tech/anima/tinytypes/jersey/TinyTypesHeaderDelegateProvider.java
import javax.ws.rs.ext.Provider;
import tech.anima.tinytypes.meta.MetaTinyType;
import tech.anima.tinytypes.meta.MetaTinyTypes;
import org.glassfish.jersey.spi.HeaderDelegateProvider;

package tech.anima.tinytypes.jersey;


@Provider
public class TinyTypesHeaderDelegateProvider<T> implements HeaderDelegateProvider<T> {

    private final Class<T> type;
    private final MetaTinyType<T> meta;