[jboss-cvs] JBossAS SVN: r102987 - projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 25 17:24:26 EDT 2010
Author: alesj
Date: 2010-03-25 17:24:21 -0400 (Thu, 25 Mar 2010)
New Revision: 102987
Modified:
projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers/DeploymentUtilsFactory.java
Log:
Make util generation public.
Modified: projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers/DeploymentUtilsFactory.java
===================================================================
--- projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers/DeploymentUtilsFactory.java 2010-03-25 21:23:12 UTC (rev 102986)
+++ projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers/DeploymentUtilsFactory.java 2010-03-25 21:24:21 UTC (rev 102987)
@@ -55,10 +55,12 @@
* @param utilType the util type
* @return util instance
*/
- protected static <T> T getUtil(DeploymentUnit unit, Class<T> utilType)
+ public static <T> T getUtil(DeploymentUnit unit, Class<T> utilType)
{
if (unit == null)
throw new IllegalArgumentException("Null unit");
+ if (utilType == null)
+ throw new IllegalArgumentException("Null util type");
T util = AttachmentLocator.searchAncestors(unit, utilType);
if (util == null)
@@ -76,18 +78,17 @@
{
throw new RuntimeException(t);
}
- }
- DeploymentUnit moduleUnit = unit;
- while(moduleUnit != null && moduleUnit.isAttachmentPresent(Module.class) == false)
- moduleUnit = moduleUnit.getParent();
+ DeploymentUnit moduleUnit = unit;
+ while(moduleUnit != null && moduleUnit.isAttachmentPresent(Module.class) == false)
+ moduleUnit = moduleUnit.getParent();
- if (moduleUnit == null)
- throw new IllegalArgumentException("No module in unit: " + unit);
+ if (moduleUnit == null)
+ throw new IllegalArgumentException("No module in unit: " + unit);
- // group util per module
- moduleUnit.addAttachment(utilType, util);
-
+ // group util per module
+ moduleUnit.addAttachment(utilType, util);
+ }
return util;
}
More information about the jboss-cvs-commits
mailing list