コード例 #1
0
  /* (non-Javadoc)
   * @see org.springframework.data.util.TypeInformation#getComponentType()
   */
  public TypeInformation<?> getComponentType() {

    if (!(isMap() || isCollectionLike())) {
      return null;
    }

    if (type instanceof ParameterizedType) {
      ParameterizedType parameterizedType = (ParameterizedType) type;
      return createInfo(parameterizedType.getActualTypeArguments()[0]);
    }

    Class<S> rawType = getType();

    if (isMap()) {
      return getTypeArgument(rawType, Map.class, 0);
    }

    if (Iterable.class.isAssignableFrom(rawType)) {
      return getTypeArgument(rawType, Iterable.class, 0);
    }

    if (rawType.isArray()) {
      return createInfo(rawType.getComponentType());
    }

    return null;
  }
コード例 #2
0
    private boolean isEnclosingClassParameter() {

      if (enclosingClassCache == null) {
        Class<T> owningType = entity.getType();
        this.enclosingClassCache =
            owningType.isMemberClass() && type.getType().equals(owningType.getEnclosingClass());
      }

      return enclosingClassCache;
    }
コード例 #3
0
  /* (non-Javadoc)
   * @see org.springframework.data.util.TypeInformation#isCollectionLike()
   */
  public boolean isCollectionLike() {

    Class<?> rawType = getType();
    return rawType.isArray() || Iterable.class.isAssignableFrom(rawType);
  }