本文整理汇总了Java中org.jboss.forge.roaster.model.JavaType.isClass方法的典型用法代码示例。如果您正苦于以下问题:Java JavaType.isClass方法的具体用法?Java JavaType.isClass怎么用?Java JavaType.isClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.forge.roaster.model.JavaType
的用法示例。
在下文中一共展示了JavaType.isClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import org.jboss.forge.roaster.model.JavaType; //导入方法依赖的package包/类
@Override
public boolean accept(JavaType<?> javaType) {
return javaType.isClass() && (javaType.getAnnotation(Generated.class.getName()) != null)
&& (javaType.getAnnotation(ComparatorDefinition.class.getName()) != null)
&& ((JavaClass) javaType).getInterfaces().stream().anyMatch(s -> s.startsWith(Comparator.class.getName()));
}
示例2: updateJavaSource
import org.jboss.forge.roaster.model.JavaType; //导入方法依赖的package包/类
private Pair<String, List<DataModelerError>> updateJavaSource(String originalSource,
DataObject dataObject,
Map<String, String> renames,
List<String> deletions,
ClassLoader classLoader) throws Exception {
String newSource;
ClassTypeResolver classTypeResolver;
List<DataModelerError> errors = new ArrayList<DataModelerError>();
if (logger.isDebugEnabled()) {
logger.debug("Starting java source update for class: " + dataObject.getClassName());
}
if (logger.isDebugEnabled()) {
logger.debug("original source is: " + originalSource);
}
JavaType<?> javaType = Roaster.parse(originalSource);
if (javaType.isClass()) {
if (javaType.getSyntaxErrors() != null && !javaType.getSyntaxErrors().isEmpty()) {
//if a file has parsing errors it will be skipped.
errors.addAll(serviceHelper.toDataModelerError(javaType.getSyntaxErrors(),
null));
newSource = originalSource;
} else {
JavaClassSource javaClassSource = (JavaClassSource) javaType;
classTypeResolver = DriverUtils.createClassTypeResolver(javaClassSource,
classLoader);
updateJavaClassSource(dataObject,
javaClassSource,
renames,
deletions,
classTypeResolver);
newSource = javaClassSource.toString();
}
} else {
logger.debug("No Class definition was found for source: " + originalSource + ", original source won't be modified.");
newSource = originalSource;
}
if (logger.isDebugEnabled()) {
logger.debug("updated source is: " + newSource);
}
return new Pair<String, List<DataModelerError>>(newSource,
errors);
}
示例3: isManagedJavaType
import org.jboss.forge.roaster.model.JavaType; //导入方法依赖的package包/类
private boolean isManagedJavaType(final JavaType<?> javaType) {
return javaType.isClass() || javaType.isEnum();
}