@Nullable public UID getKeyPredicate() { MapElements mapKey = getAnnotation(MapElements.class); if (mapKey != null) { Predicate predicate = mapKey.key(); // String parentNs = getParentNs(mapKey, getMember()); return UID.create(declaringClass.getClassNs(), predicate.ns(), predicate.ln(), null); } else { return null; } }
public List<UID> getDefaults() { Default[] defaults; Defaults defs = getAnnotation(Defaults.class); if (defs != null) { defaults = defs.value(); } else { Default def = getAnnotation(Default.class); if (def != null) { defaults = new Default[] { def }; } else { defaults = new Default[0]; } } List<UID> rs = new ArrayList<UID>(defaults.length); for (Default def : defaults) { // TODO: Use default ns and ln if there's only one default? rs.add(UID.create(null, def.ns(), def.ln(), name)); } return rs; }
@Nullable public UID getValuePredicate() { MapElements mapKey = getAnnotation(MapElements.class); if (mapKey != null) { Predicate predicate = mapKey.value(); try { // String parentNs = getParentNs(mapKey, getMember()); return UID.create(declaringClass.getClassNs(), predicate.ns(), predicate.ln(), null); } catch (IllegalArgumentException e) { return null; } } else { return null; } }
public MappedPredicate(String parentNs, Predicate predicate, @Nullable String elementName) { this.uid = UID.create(parentNs, predicate.ns(), predicate.ln(), elementName); this.inv = predicate.inv(); this.ignoreInvalid = predicate.ignoreInvalid(); this.includeInferred = predicate.includeInferred(); if (predicate.context().isEmpty()) { this.context = null; } else { this.context = new UID(predicate.context()); } }