Skip to content

Commit

Permalink
log refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Feb 8, 2018
1 parent 782570d commit a062f28
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions processor/src/main/java/org/bsc/processor/TypescriptHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public class TypescriptHelper {
false
;

private final static Consumer<String> log = msg -> System.out.println(msg);
private final static void log( String fmt, Object ...args ) {
System.out.println( format( fmt, (Object[])args));
}

/**
*
Expand Down Expand Up @@ -309,13 +311,13 @@ public static String convertJavaToTS( Type type,
if( t instanceof ParameterizedType ) {

final String typeName = convertJavaToTS( t, declaringClass, declaredClassMap, packageResolution);
log.accept(format( "Parameterized Type %s - %s", t, typeName ));
log( "Parameterized Type %s - %s", t, typeName );
result = result.replace( t.getTypeName(), typeName);

}
else if( t instanceof TypeVariable ) {

log.accept(format( "type variable: %s", t ));
log( "type variable: %s", t );

final TypeVariable<?> tv = (TypeVariable<?>)t;

Expand All @@ -330,7 +332,7 @@ else if( t instanceof TypeVariable ) {
continue;
}
else if( t instanceof Class ) {
log.accept(format( "class: %s", t.getTypeName() ));
log( "class: %s", t.getTypeName() );

final String name = convertJavaToTS( (Class<?>)t, declaringClass, declaredClassMap, packageResolution);

Expand All @@ -342,7 +344,7 @@ else if( t instanceof WildcardType ) {
final Type[] lb = wt.getLowerBounds();
final Type[] ub = wt.getUpperBounds();

log.accept(format( "Wildcard Type : %s lb:%d up:%d", type.getTypeName(), lb.length, ub.length ));
log( "Wildcard Type : %s lb:%d up:%d", type.getTypeName(), lb.length, ub.length );

if( lb.length <= 1 && ub.length==1) {
final Type tt = (lb.length==1) ? lb[0] : ub[0];
Expand All @@ -362,7 +364,7 @@ else if( t instanceof GenericArrayType ) {
return result;
}
else if( type instanceof TypeVariable ) {
log.accept(format( "class: %s", type.getTypeName() ));
log( "class: %s", type.getTypeName() );

final TypeVariable<?> tv = (TypeVariable<?>)type;

Expand All @@ -374,7 +376,7 @@ else if( type instanceof TypeVariable ) {
return type.getTypeName();
}
else if( type instanceof Class ) {
log.accept(format( "class: %s", type.getTypeName() ));
log( "class: %s", type.getTypeName() );

final String name = convertJavaToTS( (Class<?>)type, declaringClass, declaredClassMap, packageResolution);
return name;
Expand All @@ -384,7 +386,7 @@ else if( type instanceof WildcardType ) {
}
else if( type instanceof GenericArrayType ) {
final GenericArrayType t = (GenericArrayType)type;
log.accept(format( "generic array type: %s", t.getGenericComponentType().getTypeName() ));
log( "generic array type: %s", t.getGenericComponentType().getTypeName() );
//throw new IllegalArgumentException( format("type <%s> 'GenericArrayType' is a not supported yet!", type));

return ( typeParameterMatch.apply(declaringClass, t.getGenericComponentType() )) ?
Expand Down

0 comments on commit a062f28

Please sign in to comment.