/** * Gets a specific part of the name * @param namePartType specific part of the name to retrieve * @return the specific part of the name that matches the given NamePartType */ public String getPart(NamePartType namePartType) { if(this.nameForms == null || this.nameForms.isEmpty() || this.nameForms.get(0) == null || this.nameForms.get(0).getParts() == null) { return null; } for(NamePart namePart : this.nameForms.get(0).getParts()) { if(namePart.getKnownType() == namePartType) { return namePart.getValue(); } } return null; }
@Override public void visitNameForm(NameForm form) { this.contextStack.push(form); List<NamePart> parts = form.getParts(); if (parts != null) { for (NamePart part : parts) { if (part != null) { part.accept(this); } } } List<Field> fields = form.getFields(); if (fields != null) { for (Field field : fields) { if (field != null) { field.accept(this); } } } this.contextStack.pop(); }