package com.inari.commons.lang.indexed;

public abstract class IndexedTypeKey extends BaseIndexedObject implements IIndexedTypeKey {
    
    public final Class<? extends IndexedType> indexedType;

    protected IndexedTypeKey( Class<? extends IndexedType> indexedType ) {
        super();
        this.indexedType = indexedType;
        aspectGroup().createAspect( name(), index() );
    }

    @Override
    public final Class<? extends IndexedTypeKey> indexedObjectType() {
        return this.getClass();
    }

    @SuppressWarnings( "unchecked" )
    @Override
    public final <T> Class<T> type() {
        return (Class<T>) indexedType;
    }
    
    @Override
    public final String name() {
        return indexedType.getSimpleName();
    }

    @Override
    public String toString() {
        return indexedObjectType().getSimpleName() + " [indexedType=" + indexedType + ", index=" + index + "]";
    }

    final void disable() {
        aspectGroup().disposeAspect( index() );
        index = -1;
    }

    final void enable( int index ) {
        this.index = index;
        aspectGroup().createAspect( name(), index() );
    }

}

@@ -726,27 +726,41 @@
 Type.get
-SimpleName(
+Name().replace( %22.%22, %22_%22 
 );%0A    %7D

fix potential name clash for classes with same name in different packages