本文整理匯總了Java中org.eclipse.jdt.core.dom.Type.setProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Type.setProperty方法的具體用法?Java Type.setProperty怎麽用?Java Type.setProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.Type
的用法示例。
在下文中一共展示了Type.setProperty方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: rewriteTypeVariable
import org.eclipse.jdt.core.dom.Type; //導入方法依賴的package包/類
private static ParameterizedType rewriteTypeVariable(
TypeVariable2 typeCv,
CompilationUnitRewrite rewrite,
InferTypeArgumentsTCModel tCModel,
boolean leaveUnconstraindRaw,
SimpleType[] types) {
ASTNode node = typeCv.getRange().getNode(rewrite.getRoot());
if (node instanceof Name && node.getParent() instanceof Type) {
Type originalType = (Type) node.getParent();
if (types != null && !has(types, originalType)) return null;
// Must rewrite all type arguments in one batch. Do the rewrite when the first one is
// encountered; skip the others.
Object rewritten = originalType.getProperty(REWRITTEN);
if (rewritten == REWRITTEN) return null;
originalType.setProperty(REWRITTEN, REWRITTEN);
ArrayList<CollectionElementVariable2> typeArgumentCvs = getTypeArgumentCvs(typeCv, tCModel);
Type[] typeArguments =
getTypeArguments(originalType, typeArgumentCvs, rewrite, tCModel, leaveUnconstraindRaw);
if (typeArguments == null) return null;
Type movingType = (Type) rewrite.getASTRewrite().createMoveTarget(originalType);
ParameterizedType newType = rewrite.getAST().newParameterizedType(movingType);
for (int i = 0; i < typeArguments.length; i++) {
newType.typeArguments().add(typeArguments[i]);
}
rewrite
.getASTRewrite()
.replace(
originalType,
newType,
rewrite.createGroupDescription(
RefactoringCoreMessages.InferTypeArgumentsRefactoring_addTypeArguments));
return newType;
} else { // TODO: other node types?
return null;
}
}