Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBRULES-2792 Provide accessability of types and metadata for declared types #26

Merged
merged 1 commit into from Jan 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions 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 );
}
27 changes: 26 additions & 1 deletion kie-api/src/main/java/org/kie/definition/type/FactField.java
Expand Up @@ -16,6 +16,9 @@

package org.kie.definition.type;

import java.util.List;
import java.util.Map;

/**
* A field from a declared fact type
*/
Expand Down Expand Up @@ -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<Annotation> 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<String,Object> getMetaData();

}
32 changes: 32 additions & 0 deletions kie-api/src/main/java/org/kie/definition/type/FactType.java
Expand Up @@ -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
*
Expand Down Expand Up @@ -118,4 +132,22 @@ public Object get(Object bean,
*/
public void setFromMap(Object bean,
Map<String, Object> values);

/**
* Returns the list of class-level annotations
* used in this class definition
*
* @return the list of class-level annotations
*/
public List<Annotation> getClassAnnotations();


/**
* Returns the annotations of this class definition as
* key-value pairs.
*
* @return a key-value map of the class-level annotations
*/
public Map<String, Object> getMetaData();

}
@@ -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 );
}
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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<Annotation> 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<String,Object> getMetaData();

}
Expand Up @@ -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
*
Expand Down Expand Up @@ -118,4 +132,22 @@ public Object get(Object bean,
*/
public void setFromMap(Object bean,
Map<String, Object> values);


/**
* Returns the list of class-level annotations
* used in this class definition
*
* @return the list of class-level annotations
*/
public List<Annotation> getClassAnnotations();

/**
* Returns the annotations of this class definition as
* key-value pairs.
*
* @return a key-value map of the class-level annotations
*/
public Map<String, Object> getMetaData();

}