本文整理汇总了Java中com.google.javascript.rhino.JSDocInfo.isInterface方法的典型用法代码示例。如果您正苦于以下问题:Java JSDocInfo.isInterface方法的具体用法?Java JSDocInfo.isInterface怎么用?Java JSDocInfo.isInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.rhino.JSDocInfo
的用法示例。
在下文中一共展示了JSDocInfo.isInterface方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isFunctionTypeDeclaration
import com.google.javascript.rhino.JSDocInfo; //导入方法依赖的package包/类
/**
* Determines whether the given jsdoc info declares a function type.
*/
static boolean isFunctionTypeDeclaration(JSDocInfo info) {
return info.getParameterCount() > 0 ||
info.hasReturnType() ||
info.hasThisType() ||
info.isConstructor() ||
info.isInterface();
}
示例2: inferInheritance
import com.google.javascript.rhino.JSDocInfo; //导入方法依赖的package包/类
/**
* Infer the role of the function (whether it's a constructor or interface)
* and what it inherits from in JSDocInfo.
*/
FunctionTypeBuilder inferInheritance(@Nullable JSDocInfo info) {
if (info != null) {
isConstructor = info.isConstructor();
isInterface = info.isInterface();
// base type
if (info.hasBaseType()) {
if (isConstructor || isInterface) {
baseType = ObjectType.cast(info.getBaseType().evaluate(scope));
if (baseType == null) {
reportWarning(EXTENDS_NON_OBJECT, fnName, baseType.toString());
}
} else {
reportWarning(EXTENDS_WITHOUT_TYPEDEF, fnName);
}
}
// implemented interfaces
if (isConstructor || isInterface) {
implementedInterfaces = Lists.newArrayList();
for (JSTypeExpression t : info.getImplementedInterfaces()) {
ObjectType interType = ObjectType.cast(t.evaluate(scope));
if (interType != null) {
implementedInterfaces.add(interType);
} else {
reportError(BAD_IMPLEMENTED_TYPE, fnName);
}
}
if (baseType != null) {
JSType maybeFunctionType = baseType.getConstructor();
if (maybeFunctionType instanceof FunctionType) {
FunctionType functionType = baseType.getConstructor();
Iterables.addAll(
implementedInterfaces,
functionType.getImplementedInterfaces());
}
}
} else if (info.getImplementedInterfaceCount() > 0) {
reportWarning(IMPLEMENTS_WITHOUT_CONSTRUCTOR, fnName);
}
}
return this;
}