[jboss-svn-commits] JBL Code SVN: r20457 - in labs/jbossrules/trunk/drools-core/src/main/java/org/drools: rule and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jun 13 02:46:09 EDT 2008
Author: michael.neale at jboss.com
Date: 2008-06-13 02:46:09 -0400 (Fri, 13 Jun 2008)
New Revision: 20457
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/factmodel/ClassDefinition.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/FactType.java
Log:
small improvements for dynamic facts
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/factmodel/ClassDefinition.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/factmodel/ClassDefinition.java 2008-06-13 02:34:03 UTC (rev 20456)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/factmodel/ClassDefinition.java 2008-06-13 06:46:09 UTC (rev 20457)
@@ -149,7 +149,7 @@
/**
* Returns the field definition object for the given field name
- *
+ *
* @param fieldName
* @return
*/
@@ -159,17 +159,17 @@
/**
* @param beanInfo The beanInfo to set.
- * @throws NoSuchFieldException
- * @throws InvocationTargetException
- * @throws NoSuchMethodException
- * @throws ClassNotFoundException
- * @throws IntrospectionException
- * @throws IOException
- * @throws IllegalAccessException
- * @throws InstantiationException
- * @throws IllegalArgumentException
- * @throws SecurityException
- * @throws IntrospectionException
+ * @throws NoSuchFieldException
+ * @throws InvocationTargetException
+ * @throws NoSuchMethodException
+ * @throws ClassNotFoundException
+ * @throws IntrospectionException
+ * @throws IOException
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ * @throws IllegalArgumentException
+ * @throws SecurityException
+ * @throws IntrospectionException
*/
public final void buildFieldAccessors() throws SecurityException,
IllegalArgumentException,
@@ -241,4 +241,12 @@
return new ArrayList<FactField>( fields.values() );
}
+ public Object get(Object bean, String field) {
+ return this.getField(field).getFieldAccessor().getValue(bean);
+ }
+
+ public void set(Object bean, String field, Object value) {
+ this.getField(field).getFieldAccessor().setValue(bean, value);
+ }
+
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/FactType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/FactType.java 2008-06-13 02:34:03 UTC (rev 20456)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/FactType.java 2008-06-13 06:46:09 UTC (rev 20457)
@@ -1,12 +1,12 @@
/*
* Copyright 2008 JBoss Inc
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@
/**
* An interface for FactType declarations
- *
+ *
* @author etirelli
*/
public interface FactType
@@ -39,4 +39,8 @@
public Object newInstance() throws InstantiationException,
IllegalAccessException;
+
+ public void set(Object bean, String field, Object value);
+
+ public Object get(Object bean, String field);
}
More information about the jboss-svn-commits
mailing list