本文整理了Java中org.jboss.forge.addon.projects.Project.hasFacet()
方法的一些代码示例,展示了Project.hasFacet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.hasFacet()
方法的具体详情如下:
包路径:org.jboss.forge.addon.projects.Project
类名称:Project
方法名:hasFacet
暂无
代码示例来源:origin: errai/errai
@Override
public boolean isSatisfied(final Project subject) {
return subject.hasFacet(MavenFacet.class);
}
代码示例来源:origin: errai/errai
@Override
public boolean isInstalled() {
return project != null && project.hasFacet(ConfigurationFacet.class);
}
代码示例来源:origin: org.jboss.forge.addon/maven-impl-projects
@Override
public boolean isInstalled()
{
return getFaceted().hasFacet(MavenFacet.class);
}
代码示例来源:origin: errai/errai
private void installFacet(final Project project, final Class<? extends ProjectFacet> facetType) {
if (!project.hasFacet(facetType)) {
facetFactory.install(project, facetType);
}
}
代码示例来源:origin: errai/errai
@Override
public boolean filter(Feature feature, Project project) {
return !project.hasFacet(feature.getFeatureClass());
}
};
代码示例来源:origin: org.jboss.forge.addon/maven-impl-projects
@Override
public boolean isInstalled()
{
return getFaceted().hasFacet(MavenFacet.class);
}
代码示例来源:origin: errai/errai
private void copyConfigurationFile(final Project project, final Class<? extends AbstractFileResourceFacet> facetType,
final File copiedFile) throws IOException {
if (project.hasFacet(facetType)) {
final AbstractFileResourceFacet facet = project.getFacet(facetType);
final File originalFile = facet.getAbsoluteFilePath();
if (!copiedFile.exists()) {
copiedFile.getParentFile().mkdirs();
copiedFile.createNewFile();
}
try (final FileInputStream in = new FileInputStream(originalFile);
final FileOutputStream out = new FileOutputStream(copiedFile)) {
final byte[] buf = new byte[256];
int read;
while ((read = in.read(buf)) > -1) {
out.write(buf, 0, read);
}
}
}
}
代码示例来源:origin: errai/errai
@SuppressWarnings("unchecked")
@Override
public boolean isInstalled() {
/*
* An aggregator facet is installed if all of its required facets are
* installed. There is no need to do a recursive traversal, as the presence
* of direct dependencies in the project means that forge has already
* verified the installation of transitively required facets.
*/
@SuppressWarnings("rawtypes")
final Class<? extends Facet>[] constraints = getClass().getAnnotation(FacetConstraint.class).value();
for (int i = 0; i < constraints.length; i++) {
if (!getProject().hasFacet((Class<? extends ProjectFacet>) constraints[i]))
return false;
}
return true;
}
代码示例来源:origin: errai/errai
private static String generateMessage(final Class<? extends ProjectFacet> facetType, final Project project,
final BaseAggregatorFacet toUninstall) {
if (BaseAggregatorFacet.class.isAssignableFrom(facetType) && project.hasFacet(facetType)) {
final BaseAggregatorFacet facet = BaseAggregatorFacet.class.cast(project.getFacet(facetType));
return String.format("%s (%s) still requires %s.", facet.getFeatureName(), facet.getShortName(),
toUninstall.getFeatureName());
}
else {
return String.format("The facet %s still requires %s.", facetType.getSimpleName(), toUninstall.getFeatureName());
}
}
}
代码示例来源:origin: io.fabric8.forge/devops
@Override
public boolean isEnabled(UIContext context) {
// must be fabric8 and java project
boolean answer = isFabric8Project(getSelectedProjectOrNull(context));
if (answer) {
Project project = getCurrentSelectedProject(context);
answer = project.hasFacet(JavaSourceFacet.class);
}
return answer;
}
代码示例来源:origin: org.jboss.forge.addon/maven-impl-projects
@Override
public boolean isInstalled()
{
Project project = getFaceted();
return project.hasFacet(MavenFacet.class) && getRootTemplateDirectory().exists();
}
代码示例来源:origin: errai/errai
@Override
public boolean isInstalled() {
if (!getProject().hasFacet(ProjectConfig.class))
return false;
final Boolean isCoreInstalled = getProject().getFacet(ProjectConfig.class).getProjectProperty(
ProjectProperty.CORE_IS_INSTALLED, Boolean.class);
return isCoreInstalled != null && isCoreInstalled;
}
}
代码示例来源:origin: errai/errai
private void configureGwtMockitoRunner(final Project project) {
final GwtMockitoRunnerFacet runnerFacet;
if (!project.hasFacet(GwtMockitoRunnerFacet.class)) {
runnerFacet = facetFactory.install(project, GwtMockitoRunnerFacet.class);
}
else {
runnerFacet = project.getFacet(GwtMockitoRunnerFacet.class);
}
final String testPackage = getPackage(testClassName.getValue());
runnerFacet.addBlacklistedPackage(testPackage);
}
代码示例来源:origin: errai/errai
@Override
public boolean filter(Feature feature, Project project) {
final ProjectConfig projectConfig = project
.getFacet(ProjectConfig.class);
final SerializableSet installed = projectConfig.getProjectProperty(
ProjectProperty.INSTALLED_FEATURES, SerializableSet.class);
return project.hasFacet(feature.getFeatureClass())
&& installed != null && installed.contains(feature.getShortName());
}
};
代码示例来源:origin: org.jboss.forge.addon/javaee-api
@SuppressWarnings("unchecked")
static String getServletPath(Project project)
{
String servletPath = null;
if (project.hasFacet(ServletFacet.class))
{
ServletFacet servlet = project.getFacet(ServletFacet.class);
WebAppCommonDescriptor config = (WebAppCommonDescriptor) servlet.getConfig();
List<ServletMappingCommonType> allServletMapping = config.getAllServletMapping();
for (ServletMappingCommonType servletMappingType : allServletMapping)
{
if (JAXRS_SERVLET.equals(servletMappingType.getServletName()))
{
List<String> allUrlPattern = servletMappingType.getAllUrlPattern();
for (String urlPattern : allUrlPattern)
{
servletPath = urlPattern;
}
}
}
}
return servletPath;
}
代码示例来源:origin: org.jboss.forge.addon/wildfly-swarm
@Override
public Result execute(UIExecutionContext context) throws Exception
{
Project project = getSelectedProject(context);
WildFlySwarmConfigurationBuilder builder = WildFlySwarmConfigurationBuilder.create();
builder.contextPath(contextPath.getValue()).httpPort(httpPort.getValue()).portOffset(portOffset.getValue());
FacetFactory facetFactory = SimpleContainer.getServices(getClass().getClassLoader(), FacetFactory.class).get();
if (project.hasFacet(WildFlySwarmFacet.class))
{
WildFlySwarmFacet facet = project.getFacet(WildFlySwarmFacet.class);
facet.setConfiguration(builder);
}
else
{
WildFlySwarmFacet facet = facetFactory.create(project, WildFlySwarmFacet.class);
facet.setConfiguration(builder);
facetFactory.install(project, facet);
}
return Results.success("WildFly Swarm is now set up! Enjoy!");
}
}
代码示例来源:origin: org.jboss.forge.addon/parser-java-api
@Override
public Result execute(UIExecutionContext context) throws Exception
{
Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
Project project = (Project) attributeMap.get(Project.class);
if (project.hasFacet(JavaSourceFacet.class))
{
JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
MetadataFacet metadata = project.getFacet(MetadataFacet.class);
if (createMain.getValue())
{
JavaClassSource javaClass = Roaster
.create(JavaClassSource.class)
.setPackage(facet.getBasePackage())
.setName("Main")
.addMethod("public static void main(String[] args) {}")
.setBody("System.out.println(\"Hi there! I was forged as part of the project you call "
+ metadata.getProjectName()
+ ".\");")
.getOrigin();
facet.saveJavaSource(javaClass);
}
}
return null;
}
}
代码示例来源:origin: me.escoffier.forge/vertx-forge-addon
@Override
public void initializeUI(UIBuilder builder) throws Exception {
InputComponentFactory factory = builder.getInputComponentFactory();
dependencies = factory.createSelectMany("dependencies", VertxDependency.class)
.setLabel("Dependency List")
.setDescription("Dependency list");
UIContext uiContext = builder.getUIContext();
if (uiContext.getProvider().isGUI()) {
dependencies.setItemLabelConverter(VertxDependency::getName);
} else {
dependencies.setItemLabelConverter(VertxDependency::getArtifactId);
}
Project project = Projects.getSelectedProject(getProjectFactory(), uiContext);
final Collection<VertxDependency> deps;
if (project != null && project.hasFacet(VertxMavenFacet.class)) {
deps = project.getFacet(VertxMavenFacet.class).getUsedDependencies();
} else {
deps = VertxMavenFacet.getAllDependencies();
}
dependencies.setValueChoices(deps);
builder.add(dependencies);
}
代码示例来源:origin: io.fabric8.forge/devops
@Override
public void initializeUI(final UIBuilder builder) throws Exception {
super.initializeUI(builder);
Project project = getCurrentSelectedProject(builder.getUIContext());
if (project.hasFacet(JavaSourceFacet.class)) {
JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
targetPackage.setCompleter(new TestPackageNameCompleter(facet));
}
targetPackage.addValidator(new PackageNameValidator());
targetPackage.setDefaultValue("io.fabric8.itests");
className.addValidator(new ClassNameValidator(false));
className.setDefaultValue(new Callable<String>() {
@Override
public String call() throws Exception {
return "IntegrationTestKT";
}
});
builder.add(targetPackage).add(className).add(profile).add(integrationTestWildcard).add(itestPlugin);
}
代码示例来源:origin: me.escoffier.forge/vertx-forge-addon
@Override
public void initializeUI(UIBuilder builder) throws Exception {
InputComponentFactory factory = builder.getInputComponentFactory();
dependencies = factory.createSelectMany("dependencies", VertxDependency.class)
.setLabel("Dependency List")
.setDescription("Dependency list");
UIContext uiContext = builder.getUIContext();
if (uiContext.getProvider().isGUI()) {
dependencies.setItemLabelConverter(VertxDependency::getName);
} else {
dependencies.setItemLabelConverter(VertxDependency::getArtifactId);
}
Project project = Projects.getSelectedProject(getProjectFactory(), uiContext);
final Collection<VertxDependency> deps;
if (project != null && project.hasFacet(VertxMavenFacet.class)) {
deps = project.getFacet(VertxMavenFacet.class).getNotUsedDependencies();
} else {
deps = VertxMavenFacet.getAllDependencies();
}
dependencies.setValueChoices(deps);
builder.add(dependencies);
}
内容来源于网络,如有侵权,请联系作者删除!