diff --git a/kie-api/src/main/java/org/kie/definition/type/Annotation.java b/kie-api/src/main/java/org/kie/definition/type/Annotation.java new file mode 100644 index 000000000..52c55781e --- /dev/null +++ b/kie-api/src/main/java/org/kie/definition/type/Annotation.java @@ -0,0 +1,25 @@ +package org.kie.definition.type; + +/* + * Copyright 2012 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +public interface Annotation { + + public String getName(); + + public Object getPropertyValue( String key ); + + public Class getPropertyType( String key ); +} diff --git a/kie-api/src/main/java/org/kie/definition/type/FactField.java b/kie-api/src/main/java/org/kie/definition/type/FactField.java index c8b9afceb..1a81a75c8 100644 --- a/kie-api/src/main/java/org/kie/definition/type/FactField.java +++ b/kie-api/src/main/java/org/kie/definition/type/FactField.java @@ -16,6 +16,9 @@ package org.kie.definition.type; +import java.util.List; +import java.util.Map; + /** * A field from a declared fact type */ @@ -65,8 +68,30 @@ public void set(Object bean, public Object get(Object bean); + /** + * Returns the index of this field in the field list for + * the defining fact type. The list (and thus the index) + * takes into account the fields inherited from the parent + * class, if any. + * + * @return the index of this field in the defining type + */ + public int getIndex(); + /** + * Returns the list of field-level annotations + * used in this field definition + * + * @return the list of field-level annotations + */ + public List getFieldAnnotations(); - public int getIndex(); + /** + * Returns the annotations of this field definition as + * key-value pairs. + * + * @return a key-value map of the field-level annotations + */ + public Map getMetaData(); } diff --git a/kie-api/src/main/java/org/kie/definition/type/FactType.java b/kie-api/src/main/java/org/kie/definition/type/FactType.java index 8c342470d..e36c4f293 100644 --- a/kie-api/src/main/java/org/kie/definition/type/FactType.java +++ b/kie-api/src/main/java/org/kie/definition/type/FactType.java @@ -42,6 +42,20 @@ public interface FactType */ public String getName(); + /** + * Returns the unqualified name of the FactType. + * + * @return the name of the fact type. + */ + public String getSimpleName(); + + /** + * Returns the package this FactType is defined in. + * + * @return the name of the fact type's package. + */ + public String getPackageName(); + /** * Returns the name of the FactType's super type * @@ -118,4 +132,22 @@ public Object get(Object bean, */ public void setFromMap(Object bean, Map values); + + /** + * Returns the list of class-level annotations + * used in this class definition + * + * @return the list of class-level annotations + */ + public List getClassAnnotations(); + + + /** + * Returns the annotations of this class definition as + * key-value pairs. + * + * @return a key-value map of the class-level annotations + */ + public Map getMetaData(); + } diff --git a/knowledge-api/src/main/java/org/drools/definition/type/Annotation.java b/knowledge-api/src/main/java/org/drools/definition/type/Annotation.java new file mode 100644 index 000000000..896f1c477 --- /dev/null +++ b/knowledge-api/src/main/java/org/drools/definition/type/Annotation.java @@ -0,0 +1,25 @@ +package org.drools.definition.type; + +/* + * Copyright 2012 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +public interface Annotation { + + public String getName(); + + public Object getPropertyValue( String key ); + + public Class getPropertyType( String key ); +} diff --git a/knowledge-api/src/main/java/org/drools/definition/type/FactField.java b/knowledge-api/src/main/java/org/drools/definition/type/FactField.java index 17ec3fadb..b365f6452 100644 --- a/knowledge-api/src/main/java/org/drools/definition/type/FactField.java +++ b/knowledge-api/src/main/java/org/drools/definition/type/FactField.java @@ -16,6 +16,12 @@ package org.drools.definition.type; +import java.util.List; +import java.util.Map; + +import java.util.List; +import java.util.Map; + /** * A field from a declared fact type */ @@ -65,8 +71,30 @@ public void set(Object bean, public Object get(Object bean); + /** + * Returns the index of this field in the field list for + * the defining fact type. The list (and thus the index) + * takes into account the fields inherited from the parent + * class, if any. + * + * @return the index of this field in the defining type + */ + public int getIndex(); + /** + * Returns the list of field-level annotations + * used in this field definition + * + * @return the list of field-level annotations + */ + public List getFieldAnnotations(); - public int getIndex(); + /** + * Returns the annotations of this field definition as + * key-value pairs. + * + * @return a key-value map of the field-level annotations + */ + public Map getMetaData(); } diff --git a/knowledge-api/src/main/java/org/drools/definition/type/FactType.java b/knowledge-api/src/main/java/org/drools/definition/type/FactType.java index 053716b3f..928e6fff8 100644 --- a/knowledge-api/src/main/java/org/drools/definition/type/FactType.java +++ b/knowledge-api/src/main/java/org/drools/definition/type/FactType.java @@ -36,12 +36,26 @@ public interface FactType java.io.Externalizable { /** - * Returns the name of the FactType. - * + * Returns the fully qualified name of the FactType. + * * @return the name of the fact type. */ public String getName(); + /** + * Returns the unqualified name of the FactType. + * + * @return the name of the fact type. + */ + public String getSimpleName(); + + /** + * Returns the package this FactType is defined in. + * + * @return the name of the fact type's package. + */ + public String getPackageName(); + /** * Returns the name of the FactType's super type * @@ -118,4 +132,22 @@ public Object get(Object bean, */ public void setFromMap(Object bean, Map values); + + + /** + * Returns the list of class-level annotations + * used in this class definition + * + * @return the list of class-level annotations + */ + public List getClassAnnotations(); + + /** + * Returns the annotations of this class definition as + * key-value pairs. + * + * @return a key-value map of the class-level annotations + */ + public Map getMetaData(); + }