本文整理汇总了Java中org.aikodi.chameleon.core.declaration.Declarator类的典型用法代码示例。如果您正苦于以下问题:Java Declarator类的具体用法?Java Declarator怎么用?Java Declarator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Declarator类属于org.aikodi.chameleon.core.declaration包,在下文中一共展示了Declarator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toCodeClassBlock
import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
public String toCodeClassBlock(Type type) {
final StringBuffer result = new StringBuffer();
result.append("{\n");
indent();
List<? extends Declarator> members = type.directlyDeclaredElements();
// Members
for(Element element: members) {
result.append(toCode((Element)element));
result.append("\n\n");
}
undent();
result.append(startLine());
result.append("}");
return result.toString();
}
示例2: suggestedProperties
import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
@Override
public PropertySet<Element, ChameleonProperty> suggestedProperties(Declarator element) {
PropertySet<Element,ChameleonProperty> result;
if(element instanceof Declaration || element instanceof MemberVariableDeclarator) {
result = createSet(language(Java7.class).PACKAGE_ACCESSIBLE);
} else {
result = new PropertySet<Element,ChameleonProperty>();
}
return result;
}
示例3: eraseMethods
import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
private void eraseMethods() {
for(Declarator element: directlyDeclaredElements()) {
if(element instanceof Method) {
Method method = (Method)element;
eraseTypeParameters(method.typeParameters());
for(FormalParameter param: method.formalParameters()) {
JavaTypeReference typeReference = (JavaTypeReference) param.getTypeReference();
JavaTypeReference erasedReference = typeReference.erasedReference();
param.setTypeReference(erasedReference);
}
// erase return type reference
method.setReturnTypeReference(((JavaTypeReference)method.returnTypeReference()).erasedReference());
}
}
}
示例4: reactOnDescendantAdded
import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
/**
* If the added element is a constructor, the default default constructor is
* removed.
*/
public void reactOnDescendantAdded(Element element) {
if (element instanceof Declarator) {
if (isConstructor(element)) {
clearDefaultDefaultConstructor();
}
}
}
示例5: isConstructor
import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
private boolean isConstructor(Element element) {
// FIXME element.isTrue(language(Java.class).CONSTRUCTOR) doesn't work since
// the type
// and the constructor aren't connected to the model during parsing.
// The suck is strong in this one
List<Modifier> mods = ((Declarator) element).modifiers();
for (Modifier mod : mods) {
if (mod instanceof JavaConstructor) {
return true;
}
}
return false;
}
示例6: reactOnDescendantRemoved
import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
/**
* If an element is removed, we check whether it is the last remaining
* constructor. If it is, we add the default default constructor.
*/
public void reactOnDescendantRemoved(Element element) {
if (isConstructor(element)) {
List<Declarator> elements = body().elements();
for (Declarator el : elements) {
if (isConstructor(el)) {
return;
}
}
setDefaultDefaultConstructor(true);
}
}
示例7: MemberPackageAccessibleByDefault
import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
public MemberPackageAccessibleByDefault() {
super(Declarator.class);
}
示例8: visitClassBody
import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
@Override
public Consumer<ClassBody> visitClassBody(ClassBodyContext ctx) {
return b -> ctx.bodyElement().stream().forEach(e -> b.add((Declarator)visitBodyElement(e)));
}