Example #1
0
 public FormItemPath asNewWithoutFirstPathElement() {
   final List<String> pathElements = Lists.newArrayList();
   for (int i = 0; i < elements.size(); i++) {
     if (i > 0) {
       pathElements.add(elements.get(i));
     }
   }
   return FormItemPath.from(pathElements);
 }
Example #2
0
  public FormItemPath(final ImmutableList<String> elementNames) {
    Preconditions.checkNotNull(elementNames, "elementNames cannot be null");

    this.elements = elementNames;

    final List<String> parentPathElements = Lists.newArrayList();
    for (int i = 0; i < this.elements.size(); i++) {
      if (i < this.elements.size() - 1) {
        parentPathElements.add(this.elements.get(i));
      }
    }
    this.parentPath = parentPathElements.size() > 0 ? FormItemPath.from(parentPathElements) : null;
    this.refString = toString(this.elements);
  }