Java2OWL
Class PropertyWrapperMappingRelational
Object
PropertyWrapper
PropertyWrapperMappingRelational
public class PropertyWrapperMappingRelational
- extends PropertyWrapper
for accessor groups of Map-type, for example HashMap> or HashMap
HashMap<String,Set<TestMapper>> friends = new HashMap<String,Set<TestMapper>>();
@J2OWLProperty(name = "hasFriends", setter = "setFriends", adder="addFriends,addFriend", remover="removeFriends,removeFriend",
clearer="clearFriends")
public HashMap<String,Set<TestMapper>> getFriends() {return friends;}
public void setFriends(Object friends) {
assert(friends instanceof HashMap);
this.friends = (HashMap<String,Set<TestMapper>>)friends;}
public Set<TestMapper> getFriends(String key) {return friends.get(key);}
public void addFriends(String key, Object f1) {
assert(f1 instanceof Set);
friends.put(key,(Set<TestMapper>)f1);}
public void addFriend(String key, TestMapper f) {
if(friends.get(key) == null) {friends.put(key,new HashSet<TestMapper>());}
friends.get(key).add(f);
}
public void removeFriends(String key) {friends.remove(key);}
public void removeFriend(String key,TestMapper f) {
Object fr = friends.get(key);
if(fr != null) {
((Set<TestMapper>)fr).remove(f);
if(((Set<TestMapper>)fr).isEmpty()) friends.remove(key);}}
public void clearFriends() {friends.clear();}
Fields inherited from class PropertyWrapper |
addRangeAxiom, asymmetric, currentClass, currentPWC, irreflexive, isFunctional, key2Property, logger, manager, name, property, pwComponents, reflexive, symmetric, transitive |
Method Summary |
protected Method |
checkGetKey(Method accessor,
StringBuffer errors)
checks the getKey accessor. |
protected boolean |
determineClasses(StringBuffer errors)
determines the key and range classes |
protected void |
findAccessors(J2OWLProperty annotation,
StringBuffer errors,
StringBuffer warnings)
finds adder and clearer methods and checks the other ones |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
determineClasses
protected boolean determineClasses(StringBuffer errors)
- determines the key and range classes
- Specified by:
determineClasses
in class PropertyWrapper
- Parameters:
errors
- collects error messages.
- Returns:
- true if the classes are okay.
findAccessors
protected void findAccessors(J2OWLProperty annotation,
StringBuffer errors,
StringBuffer warnings)
- finds adder and clearer methods and checks the other ones
- Specified by:
findAccessors
in class PropertyWrapper
checkGetKey
protected Method checkGetKey(Method accessor,
StringBuffer errors)
- checks the getKey accessor. It must accept a string as argument