Codota Logo
Path
Code IndexAdd Codota to your IDE (free)

How to use
Path
in
com.yahoo.elide.core

Best Java code snippets using com.yahoo.elide.core.Path (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: yahoo/elide

  public TruePredicate(PathElement pathElement) {
    this(new Path(Collections.singletonList(pathElement)));
  }
}
origin: yahoo/elide

public Class getEntityType() {
  List<PathElement> elements = path.getPathElements();
  PathElement first = elements.get(0);
  return first.getType();
}
origin: yahoo/elide

/**
 * Returns an alias that uniquely identifies the last collection of entities in the path.
 * @return An alias for the path.
 */
public String getAlias() {
  if (pathElements.size() < 2) {
    return lastElement()
        .map(e -> getTypeAlias(e.getType()))
        .orElse(null);
  }
  PathElement previous = pathElements.get(pathElements.size() - 2);
  return getTypeAlias(previous.getType()) + UNDERSCORE + previous.getFieldName();
}
origin: yahoo/elide

public FilterPredicate(Path path, Operator op, List<Object> values) {
  this.operator = op;
  this.path = new Path(path);
  this.values = ImmutableList.copyOf(values);
  this.field = path.lastElement()
      .map(PathElement::getFieldName)
      .orElse(null);
  this.fieldPath = path.getPathElements().stream()
      .map(PathElement::getFieldName)
      .collect(Collectors.joining(PERIOD));
}
origin: yahoo/elide

/**
 * Create a copy of this filter that is scoped by scope. This is used in calculating page totals, we need to
 * scope this filter in the context of it's parent.
 *
 * @param scope the path element to add to the head of the path
 * @return the scoped filter expression.
 */
public FilterPredicate scopedBy(PathElement scope) {
  List<PathElement> pathElements = Lists.asList(scope, path.getPathElements().toArray(ELEMENT_ARRAY));
  return new FilterPredicate(new Path(pathElements), operator, values);
}
origin: yahoo/elide

/**
 * Given the sorting rules validate sorting rules against the entities bound to the entityClass.
 * @param entityClass  The root class for sorting (eg. /book?sort=-title this would be package.Book)
 * @param dictionary The elide entity dictionary
 * @param <T> The entityClass
 * @return The valid sorting rules - validated through the entity dictionary, or empty dictionary
 * @throws InvalidValueException when sorting values are not valid for the jpa entity
 */
public <T> Map<Path, SortOrder> getValidSortingRules(final Class<T> entityClass,
                           final EntityDictionary dictionary)
    throws InvalidValueException {
  Map<Path, SortOrder> returnMap = new LinkedHashMap<>();
  for (Map.Entry<String, SortOrder> entry : replaceIdRule(dictionary.getIdFieldName(entityClass)).entrySet()) {
    String dotSeparatedPath = entry.getKey();
    SortOrder order = entry.getValue();
    //Creating a path validates that the dot separated path is valid.
    Path path = new Path(entityClass, dictionary, dotSeparatedPath);
    if (! isValidSortRulePath(path, dictionary)) {
      throw new InvalidValueException("Cannot sort across a to-many relationship: " + path.getFieldPath());
    }
    returnMap.put(path, order);
  }
  return returnMap;
}
origin: yahoo/elide

Path path = entry.getKey();
String prefix = (prefixWithAlias) ? Path.getTypeAlias(sortClass) + PERIOD : "";
ordering.add(prefix + path.getFieldPath() + SPACE
    + (entry.getValue().equals(Sorting.SortOrder.desc) ? "desc" : "asc"));
origin: yahoo/elide

private FilterExpression equalityExpression(String argument, Path path, List<Object> values) {
  boolean startsWith = argument.startsWith("*");
  boolean endsWith = argument.endsWith("*");
  if (startsWith && endsWith && argument.length() > 2) {
    String value = argument.substring(1, argument.length() - 1);
    return new FilterPredicate(path, caseSensitivityStrategy.mapOperator(Operator.INFIX),
        Collections.singletonList(value));
  }
  if (startsWith && argument.length() > 1) {
    String value = argument.substring(1, argument.length());
    return new FilterPredicate(path, caseSensitivityStrategy.mapOperator(Operator.POSTFIX),
        Collections.singletonList(value));
  }
  if (endsWith && argument.length() > 1) {
    String value = argument.substring(0, argument.length() - 1);
    return new FilterPredicate(path, caseSensitivityStrategy.mapOperator(Operator.PREFIX),
        Collections.singletonList(value));
  }
  Boolean isStringLike = path.lastElement()
      .map(e -> e.getFieldType().isAssignableFrom(String.class))
      .orElse(false);
  if (isStringLike) {
    return new FilterPredicate(path, caseSensitivityStrategy.mapOperator(Operator.IN), values);
  }
  return new InPredicate(path, values);
}
origin: com.yahoo.elide/elide-core

public FilterPredicate(Path path, Operator op, List<Object> values) {
  this.operator = op;
  this.path = new Path(path);
  this.values = ImmutableList.copyOf(values);
  this.field = path.lastElement()
      .map(PathElement::getFieldName)
      .orElse(null);
  this.fieldPath = path.getPathElements().stream()
      .map(PathElement::getFieldName)
      .collect(Collectors.joining(PERIOD));
}
origin: com.yahoo.elide/elide-core

/**
 * Create a copy of this filter that is scoped by scope. This is used in calculating page totals, we need to
 * scope this filter in the context of it's parent.
 *
 * @param scope the path element to add to the head of the path
 * @return the scoped filter expression.
 */
public FilterPredicate scopedBy(PathElement scope) {
  List<PathElement> pathElements = Lists.asList(scope, path.getPathElements().toArray(ELEMENT_ARRAY));
  return new FilterPredicate(new Path(pathElements), operator, values);
}
origin: com.yahoo.elide/elide-core

/**
 * Given the sorting rules validate sorting rules against the entities bound to the entityClass.
 * @param entityClass  The root class for sorting (eg. /book?sort=-title this would be package.Book)
 * @param dictionary The elide entity dictionary
 * @param <T> The entityClass
 * @return The valid sorting rules - validated through the entity dictionary, or empty dictionary
 * @throws InvalidValueException when sorting values are not valid for the jpa entity
 */
public <T> Map<Path, SortOrder> getValidSortingRules(final Class<T> entityClass,
                           final EntityDictionary dictionary)
    throws InvalidValueException {
  Map<Path, SortOrder> returnMap = new LinkedHashMap<>();
  for (Map.Entry<String, SortOrder> entry : replaceIdRule(dictionary.getIdFieldName(entityClass)).entrySet()) {
    String dotSeparatedPath = entry.getKey();
    SortOrder order = entry.getValue();
    //Creating a path validates that the dot separated path is valid.
    Path path = new Path(entityClass, dictionary, dotSeparatedPath);
    if (! isValidSortRulePath(path, dictionary)) {
      throw new InvalidValueException("Cannot sort across a to-many relationship: " + path.getFieldPath());
    }
    returnMap.put(path, order);
  }
  return returnMap;
}
origin: com.yahoo.elide/elide-core

private FilterExpression equalityExpression(String argument, Path path, List<Object> values) {
  boolean startsWith = argument.startsWith("*");
  boolean endsWith = argument.endsWith("*");
  if (startsWith && endsWith && argument.length() > 2) {
    String value = argument.substring(1, argument.length() - 1);
    return new FilterPredicate(path, caseSensitivityStrategy.mapOperator(Operator.INFIX),
        Collections.singletonList(value));
  }
  if (startsWith && argument.length() > 1) {
    String value = argument.substring(1, argument.length());
    return new FilterPredicate(path, caseSensitivityStrategy.mapOperator(Operator.POSTFIX),
        Collections.singletonList(value));
  }
  if (endsWith && argument.length() > 1) {
    String value = argument.substring(0, argument.length() - 1);
    return new FilterPredicate(path, caseSensitivityStrategy.mapOperator(Operator.PREFIX),
        Collections.singletonList(value));
  }
  Boolean isStringLike = path.lastElement()
      .map(e -> e.getFieldType().isAssignableFrom(String.class))
      .orElse(false);
  if (isStringLike) {
    return new FilterPredicate(path, caseSensitivityStrategy.mapOperator(Operator.IN), values);
  }
  return new InPredicate(path, values);
}
origin: yahoo/elide

  public GTPredicate(PathElement pathElement, Object value) {
    this(new Path(Collections.singletonList(pathElement)), value);
  }
}
origin: com.yahoo.elide/elide-core

public Class getEntityType() {
  List<PathElement> elements = path.getPathElements();
  PathElement first = elements.get(0);
  return first.getType();
}
origin: com.yahoo.elide/elide-core

/**
 * Returns an alias that uniquely identifies the last collection of entities in the path.
 * @return An alias for the path.
 */
public String getAlias() {
  if (pathElements.size() < 2) {
    return lastElement()
        .map(e -> getTypeAlias(e.getType()))
        .orElse(null);
  }
  PathElement previous = pathElements.get(pathElements.size() - 2);
  return getTypeAlias(previous.getType()) + UNDERSCORE + previous.getFieldName();
}
origin: yahoo/elide

Class<?> relationshipType = path.lastElement()
    .map(Path.PathElement::getFieldType)
    .orElseThrow(() -> new IllegalStateException("Path must not be empty"));
origin: yahoo/elide

  public LTPredicate(PathElement pathElement, Object value) {
    this(new Path(Collections.singletonList(pathElement)), value);
  }
}
origin: com.yahoo.elide/elide-core

@Override
public String toString() {
  List<PathElement> elements = path.getPathElements();
  StringBuilder formattedPath = new StringBuilder();
  if (!elements.isEmpty()) {
    formattedPath.append(StringUtils.uncapitalize(EntityDictionary.getSimpleName(elements.get(0).getType())));
  }
  for (PathElement element : elements) {
    formattedPath.append(PERIOD).append(element.getFieldName());
  }
  return formattedPath.append(' ').append(operator).append(' ').append(values).toString();
}
origin: com.yahoo.elide/elide-core

Class<?> relationshipType = path.lastElement()
    .map(Path.PathElement::getFieldType)
    .orElseThrow(() -> new IllegalStateException("Path must not be empty"));
origin: yahoo/elide

  public LEPredicate(PathElement pathElement, Object value) {
    this(new Path(Collections.singletonList(pathElement)), value);
  }
}
com.yahoo.elide.corePath

Javadoc

Represents a path in the entity relationship graph.

Most used methods

  • <init>
  • getFieldPath
  • getPathElements
  • getTypeAlias
    Convert a class name into a hibernate friendly name.
  • lastElement

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • putExtra (Intent)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • JTable (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now