code: public static List<Object> getValuesForPathComponent(Object entityOrString, String pathComponent) {
  
          List<Object> result = Lists.newArrayList();
          if (pathComponent.equals("VALUE")) {
              result.add(entityOrString);
          } else {
              if (entityOrString instanceof CmsEntity) {
                  CmsEntity entity = (CmsEntity)entityOrString;
                  boolean hasIndex = CmsContentDefinition.hasIndex(pathComponent);
                  int index = CmsContentDefinition.extractIndex(pathComponent);
                  if (index > 0) {
                      index--;
                  }
                  String attributeName = entity.getTypeName() + "/" + CmsContentDefinition.removeIndex(pathComponent);
                  CmsEntityAttribute attribute = entity.getAttribute(attributeName);
  
                  if (attribute != null) {
                      if (hasIndex) {
                          if (index < attribute.getValueCount()) {
                              if (attribute.isSimpleValue()) {
                                  result.add(attribute.getSimpleValues().get(index));
                              } else {
                                  result.add(attribute.getComplexValues().get(index));
                              }
                          }
                      } else {
                          if (attribute.isSimpleValue()) {
                              result.addAll(attribute.getSimpleValues());
                          } else {
                              result.addAll(attribute.getComplexValues());
                          }
                      }
                  }
              }
          }
          return result;
      }
docs: Gets the values reachable from a given object (an entity or a string) with a single XPath component.<p>
  
  If entityOrString is a string, and pathComponent is "VALUE", a list containing only entityOrString is returned.
  Otherwise, entityOrString is assumed to be an entity, and the pathComponent is interpreted as a field of the entity
  (possibly with an index).
  
  @param entityOrString the entity or string from which to get the values for the given path component
  @param pathComponent the path component
  @return the list of reachable values