Created
July 30, 2012 22:57
-
-
Save gastaldi/3211542 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.george.hint.impl; | |
| import org.jboss.forge.project.Facet; | |
| import org.jboss.forge.project.Project; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| /** | |
| * A Holder object to ease working with Drools | |
| * | |
| * @author ggastald | |
| * | |
| */ | |
| public class DroolsHintHolder | |
| { | |
| private Logger logger = LoggerFactory.getLogger(DroolsHintHolder.class); | |
| private Project project; | |
| private String output; | |
| public DroolsHintHolder(Project project) | |
| { | |
| this.project = project; | |
| } | |
| /** | |
| * Returns if this project have this facet enabled | |
| * | |
| * @param facetClassName | |
| * @return | |
| */ | |
| @SuppressWarnings("unchecked") | |
| public boolean hasFacet(String facetClassName) | |
| { | |
| if (project == null) | |
| { | |
| return false; | |
| } | |
| else | |
| { | |
| Class<?> facetClass; | |
| try | |
| { | |
| facetClass = Class.forName(facetClassName, true, getClass().getClassLoader()); | |
| } | |
| catch (ClassNotFoundException e) | |
| { | |
| logger.debug("Class not found in this forge installation: " + facetClassName); | |
| return false; | |
| } | |
| return project.hasFacet((Class<? extends Facet>) facetClass); | |
| } | |
| } | |
| public Project getProject() | |
| { | |
| return project; | |
| } | |
| public String getOutput() | |
| { | |
| return output; | |
| } | |
| public void setOutput(String output) | |
| { | |
| this.output = output; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment