mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 15:29:22 +00:00
added utility method
This commit is contained in:
parent
6668b64895
commit
f00c09a413
@ -3,6 +3,7 @@ package org.jsweet.transpiler.model;
|
||||
import java.util.List;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
||||
/**
|
||||
@ -12,6 +13,11 @@ import javax.lang.model.type.TypeMirror;
|
||||
*/
|
||||
public interface Util {
|
||||
|
||||
/**
|
||||
* Returns true if the given type is an interface.
|
||||
*/
|
||||
boolean isInterface(TypeElement type);
|
||||
|
||||
/**
|
||||
* Gets the qualified name for the given type.
|
||||
*/
|
||||
|
||||
@ -29,6 +29,7 @@ import javax.lang.model.type.TypeMirror;
|
||||
import org.jsweet.transpiler.JSweetContext;
|
||||
import org.jsweet.transpiler.model.Util;
|
||||
|
||||
import com.sun.tools.javac.code.Symbol.TypeSymbol;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import com.sun.tools.javac.code.Type.CapturedType;
|
||||
import com.sun.tools.javac.tree.JCTree;
|
||||
@ -181,7 +182,7 @@ public class UtilSupport implements Util {
|
||||
public String getRelativePath(String fromPath, String toPath) {
|
||||
return org.jsweet.transpiler.util.Util.getRelativePath(fromPath, toPath);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getTypeInitialValue(TypeMirror type) {
|
||||
if (type == null) {
|
||||
@ -197,6 +198,13 @@ public class UtilSupport implements Util {
|
||||
return "null";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInterface(TypeElement type) {
|
||||
if (type instanceof TypeSymbol) {
|
||||
return context.isInterface((TypeSymbol) type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user