/** * This will acquire the name of the <code>Root</code> annotation * for the specified class. This will traverse the inheritance * hierarchy looking for the root annotation, when it is found it * is used to acquire a name for the XML element it represents. * * @param real the actual type of the object being searched * @param type this is the type to acquire the root name with * * @return the root name for the specified type if it exists */ private String getRoot(Class<?> real, Class<?> type) { String name = type.getSimpleName(); Root root = type.getAnnotation(Root.class); if(root != null) { String text = root.name(); if(!isEmpty(text)) { return text; } return Reflector.getName(name); } return null; }
/** * This will acquire the name of the <code>Root</code> annotation * for the specified class. This will traverse the inheritance * hierarchy looking for the root annotation, when it is found it * is used to acquire a name for the XML element it represents. * * @param real the actual type of the object being searched * @param type this is the type to acquire the root name with * * @return the root name for the specified type if it exists */ private String getRoot(Class<?> real, Class<?> type) { String name = type.getSimpleName(); Root root = type.getAnnotation(Root.class); if(root != null) { String text = root.name(); if(!isEmpty(text)) { return text; } return Reflector.getName(name); } return null; }
/** * This will acquire the name of the <code>Root</code> annotation * for the specified class. This will traverse the inheritance * hierarchy looking for the root annotation, when it is found it * is used to acquire a name for the XML element it represents. * * @param real the actual type of the object being searched * @param type this is the type to acquire the root name with * * @return the root name for the specified type if it exists */ private String getRoot(Class<?> real, Class<?> type) { String name = type.getSimpleName(); Root root = type.getAnnotation(Root.class); if(root != null) { String text = root.name(); if(!isEmpty(text)) { return text; } return Reflector.getName(name); } return null; }
/** * This is used to set the optional <code>Root</code> annotation for * the class. The root can only be set once, so if a super type also * has a root annotation define it must be ignored. * * @param label this is the label used to define the root */ private void root(Annotation label) { if(label != null) { Root value = (Root)label; String real = type.getSimpleName(); String text = real; if(value != null) { text = value.name(); if(isEmpty(text)) { text = Reflector.getName(real); } strict = value.strict(); root = value; name = text; } } }
/** * This is used to set the optional <code>Root</code> annotation for * the class. The root can only be set once, so if a super type also * has a root annotation define it must be ignored. * * @param label this is the label used to define the root */ private void root(Annotation label) { if(label != null) { Root value = (Root)label; String real = type.getSimpleName(); String text = real; if(value != null) { text = value.name(); if(isEmpty(text)) { text = Reflector.getName(real); } strict = value.strict(); root = value; name = text; } } }
/** * This is used to set the optional <code>Root</code> annotation for * the class. The root can only be set once, so if a super type also * has a root annotation define it must be ignored. * * @param label this is the label used to define the root */ private void root(Annotation label) { if(label != null) { Root value = (Root)label; String real = type.getSimpleName(); String text = real; if(value != null) { text = value.name(); if(isEmpty(text)) { text = Reflector.getName(real); } strict = value.strict(); root = value; name = text; } } }
public DavAce(Ace ace) { principal = new DavPrincipal(ace.getPrincipal()); granted = new ArrayList<>(); denied = new ArrayList<>(); if (ace.getGrant() != null) { for (Privilege p : ace.getGrant().getPrivilege()) { for (SimplePrivilege o : p.getContent()) { granted.add(o.getClass().getAnnotation(Root.class).name()); } } } if (ace.getDeny() != null) { for (Privilege p : ace.getDeny().getPrivilege()) { for (SimplePrivilege o : p.getContent()) { denied.add(o.getClass().getAnnotation(Root.class).name()); } } } if (ace.getInherited() != null) { inherited = ace.getInherited().getHref(); } else { inherited = null; } this.isprotected = (ace.getProtected() != null); }