当前位置: 首页>>代码示例>>Java>>正文


Java Declarator类代码示例

本文整理汇总了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();
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:18,代码来源:Java7Syntax.java

示例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;
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:11,代码来源:MemberPackageAccessibleByDefault.java

示例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());
    }
  }
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:16,代码来源:RawType.java

示例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();
		}
	}
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:12,代码来源:RegularJavaType.java

示例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;
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:14,代码来源:RegularJavaType.java

示例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);
	}
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:16,代码来源:RegularJavaType.java

示例7: MemberPackageAccessibleByDefault

import org.aikodi.chameleon.core.declaration.Declarator; //导入依赖的package包/类
public MemberPackageAccessibleByDefault() {
	super(Declarator.class);
}
 
开发者ID:markovandooren,项目名称:jnome,代码行数:4,代码来源:MemberPackageAccessibleByDefault.java

示例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)));
}
 
开发者ID:markovandooren,项目名称:jlo,代码行数:5,代码来源:JLoConvertor.java


注:本文中的org.aikodi.chameleon.core.declaration.Declarator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。