/*
 *  Copyright the original author or authors.
 *
 *  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 therian;

import java.lang.reflect.Type;

import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.reflect.TypeUtils;

/**
 * Same old "Type literal."
 */
public abstract class TypeLiteral<T> {
    public final Type value;

    protected TypeLiteral() {
        this.value =
            ObjectUtils
                .defaultIfNull(
                    TypeUtils.getTypeArguments(getClass(), TypeLiteral.class).get(
                        TypeLiteral.class.getTypeParameters()[0]), Object.class);
    }

    @Override
    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof TypeLiteral == false) {
            return false;
        }
        TypeLiteral<?> other = (TypeLiteral<?>) obj;
        return value.equals(other.value);
    }

    @Override
    public int hashCode() {
        return (37 << 4) | value.hashCode();
    }
}

@@ -832,16 +832,36 @@
 teral%3CT%3E
+ implements Typed%3CT%3E
  %7B%0A    p
@@ -936,16 +936,20 @@
 value =%0A
+    
         
@@ -1540,17 +1540,15 @@
 urn 
-(
 37 %3C%3C 4
-)
  %7C v
@@ -1569,11 +1569,82 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public Type getType() %7B%0A        return value;%0A    %7D
 %0A%7D%0A

implement Typed