-
Notifications
You must be signed in to change notification settings - Fork 128
Ruleset Java Code Matching Examples
sgilda edited this page Sep 3, 2015
·
14 revisions
DRAFT This page will contain rule snippets for Java code matching, AND the java code they are supposed to match. Try
git grep '<when>'
if you want to add.package com.mycompany.app;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.def.ProcessDefinition;
...
<rule id="UNIQUE_RULE_ID">
<when>
<javaclass references="org.jbpm.graph.def.ActionHandler" as="default">
<location>INHERITANCE</location>
</javaclass>
</when>
<perform>
<iteration>
<hint message="Migrate to jBPM 5 org.drools.runtime.process.WorkItemHandler." effort="2">
</hint>
</iteration>
</perform>
</rule>
(See rules-java-ee/src/main/resources/legacy/org.jboss.windup.rules.apps.legacy.java.JBossConfig.windup.xml
)
import org.jbpm.graph.exe.ExecutionContext;
...
public void myMethod( ExecutionContext exCtx){
exCtx.setVariable("foo", "bar");
}
...
<rule id="UNIQUE_RULE_ID">
<when>
<javaclass references="org.jbpm.graph.exe.ExecutionContext.setVariable" as="default">
<location>METHOD</location>
</javaclass>
</when>
<perform>
<iteration>
<hint effort="0">...</hint>
</iteration>
</perform>
</rule>
import org.jboss.ejb3.annotation.Management;
...
@Service( name = "DeliveryManager" )
@Local( DeliveryManagerLocal.class )
@Management( DeliveryManagerManagement.class )
public class DeliveryManager implements DeliveryManagerManagement
{
@Resource( mappedName = "Delivery/remote" )
DeliveryRemote delivery;
<when>
<javaclass references="org.jboss.ejb3.annotation.Management" as="default">
<location>ANNOTATION</location>
</javaclass>
</when>
public interface StockHome extends javax.ejb.EJBHome
{
Stock create() throws java.rmi.RemoteException, javax.ejb.CreateException;
}
...
<when>
<javaclass references="javax.ejb.EJBHome" as="default">
<location>INHERITANCE</location>
</javaclass>
</when>
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://localhost:1099");
<when>
<javaclass references="javax.management.remote.JMXServiceURL({*})" as="default">
<location>CONSTRUCTOR_CALL</location>
</javaclass>
</when>
...
<when>
<javaclass references="java.awt.Frame.E_RESIZE_CURSOR" as="default">
<location>TYPE</location>
</javaclass>
</when>
Template: