Add necessary stubs for Spring

Co-Authored-By: smowton <smowton@github.com>
This commit is contained in:
Sauyon Lee
2021-06-29 06:44:25 -07:00
parent fc7e062deb
commit 16931e5de8
13 changed files with 923 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
/*
* Copyright 2008-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.domain;
import java.util.Collections;
import java.util.function.Function;
public interface Page<T> extends Slice<T> {
static <T> Page<T> empty() {
return null;
}
static <T> Page<T> empty(Pageable pageable) {
return null;
}
int getTotalPages();
long getTotalElements();
<U> Page<U> map(Function<? super T, ? extends U> converter);
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright 2008-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.domain;
import java.util.Optional;
public interface Pageable {
static Pageable unpaged() {
return null;
}
static Pageable ofSize(int pageSize) {
return null;
}
default boolean isPaged() {
return false;
}
default boolean isUnpaged() {
return false;
}
int getPageNumber();
int getPageSize();
long getOffset();
Sort getSort();
default Sort getSortOr(Sort sort) {
return null;
}
Pageable next();
Pageable previousOrFirst();
Pageable first();
Pageable withPage(int pageNumber);
boolean hasPrevious();
default Optional<Pageable> toOptional() {
return null;
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2014-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.domain;
import java.util.List;
import java.util.function.Function;
import org.springframework.data.util.Streamable;
public interface Slice<T> extends Streamable<T> {
int getNumber();
int getSize();
int getNumberOfElements();
List<T> getContent();
boolean hasContent();
Sort getSort();
boolean isFirst();
boolean isLast();
boolean hasNext();
boolean hasPrevious();
default Pageable getPageable() {
return null;
}
Pageable nextPageable();
Pageable previousPageable();
<U> Slice<U> map(Function<? super T, ? extends U> converter);
default Pageable nextOrLastPageable() {
return null;
}
default Pageable previousOrFirstPageable() {
return null;
}
}

View File

@@ -0,0 +1,237 @@
/*
* Copyright 2008-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.data.util.Streamable;
import org.springframework.data.util.MethodInvocationRecorder.Recorded;
import org.springframework.lang.Nullable;
public class Sort implements Streamable<org.springframework.data.domain.Sort.Order>, Serializable {
public static Sort by(String... properties) {
return null;
}
public static Sort by(List<Order> orders) {
return null;
}
public static Sort by(Order... orders) {
return null;
}
public static Sort by(Direction direction, String... properties) {
return null;
}
public static <T> TypedSort<T> sort(Class<T> type) {
return null;
}
public static Sort unsorted() {
return null;
}
public Sort descending() {
return null;
}
public Sort ascending() {
return null;
}
public boolean isSorted() {
return false;
}
public boolean isUnsorted() {
return false;
}
public Sort and(Sort sort) {
return null;
}
public Order getOrderFor(String property) {
return null;
}
public Iterator<Order> iterator() {
return null;
}
@Override
public boolean equals(@Nullable Object obj) {
return false;
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return null;
}
public static class Order implements Serializable {
public Order(@Nullable Direction direction, String property) {
}
public Order(@Nullable Direction direction, String property, NullHandling nullHandlingHint) {
}
public static Order by(String property) {
return null;
}
public static Order asc(String property) {
return null;
}
public static Order desc(String property) {
return null;
}
public Direction getDirection() {
return null;
}
public String getProperty() {
return null;
}
public boolean isAscending() {
return false;
}
public boolean isDescending() {
return false;
}
public boolean isIgnoreCase() {
return false;
}
public Order with(Direction direction) {
return null;
}
public Order withProperty(String property) {
return null;
}
public Sort withProperties(String... properties) {
return null;
}
public Order ignoreCase() {
return null;
}
public Order with(NullHandling nullHandling) {
return null;
}
public Order nullsFirst() {
return null;
}
public Order nullsLast() {
return null;
}
public Order nullsNative() {
return null;
}
public NullHandling getNullHandling() {
return null;
}
@Override
public int hashCode() {
return 0;
}
@Override
public boolean equals(@Nullable Object obj) {
return false;
}
@Override
public String toString() {
return null;
}
}
public static class TypedSort<T> extends Sort {
public <S> TypedSort<S> by(Function<T, S> property) {
return null;
}
public <S> TypedSort<S> by(Recorded.ToCollectionConverter<T, S> collectionProperty) {
return null;
}
public <S> TypedSort<S> by(Recorded.ToMapConverter<T, S> mapProperty) {
return null;
}
@Override
public Sort ascending() {
return null;
}
@Override
public Sort descending() {
return null;
}
@Override
public Iterator<Order> iterator() {
return null;
}
@Override
public String toString() {
return null;
}
}
public static enum Direction {
ASC, DESC;
public boolean isAscending() { return true; }
public boolean isDescending() { return true; }
public static Direction fromString(String value) { return null; }
public static Optional<Direction> fromOptionalString(String value) { return null; }
}
public static enum NullHandling { NATIVE, NULLS_FIRST, NULLS_LAST; }
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright 2008-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.repository;
import java.util.Optional;
public interface CrudRepository<T, ID> extends Repository<T, ID> {
<S extends T> S save(S entity);
<S extends T> Iterable<S> saveAll(Iterable<S> entities);
Optional<T> findById(ID id);
boolean existsById(ID id);
Iterable<T> findAll();
Iterable<T> findAllById(Iterable<ID> ids);
long count();
void deleteById(ID id);
void delete(T entity);
void deleteAllById(Iterable<? extends ID> ids);
void deleteAll(Iterable<? extends T> entities);
void deleteAll();
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2008-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.repository;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface PagingAndSortingRepository<T, ID> extends CrudRepository<T, ID> {
Iterable<T> findAll(Sort sort);
Page<T> findAll(Pageable pageable);
}

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2011-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.repository;
public interface Repository<T, ID> {
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright 2016-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.util;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
public class MethodInvocationRecorder {
public static <T> Recorded<T> forProxyOf(Class<T> type) {
return null;
}
public interface PropertyNameDetectionStrategy {
String getPropertyName(Method method);
}
public static class Recorded<T> {
public Optional<String> getPropertyPath() {
return null;
}
public Optional<String> getPropertyPath(PropertyNameDetectionStrategy strategy) {
return null;
}
public Optional<String> getPropertyPath(List<PropertyNameDetectionStrategy> strategies) {
return null;
}
public <S> Recorded<S> record(Function<? super T, S> converter) {
return null;
}
public <S> Recorded<S> record(ToCollectionConverter<T, S> converter) {
return null;
}
public <S> Recorded<S> record(ToMapConverter<T, S> converter) {
return null;
}
@Override
public String toString() {
return null;
}
public interface ToCollectionConverter<T, S> extends Function<T, Collection<S>> {
}
public interface ToMapConverter<T, S> extends Function<T, Map<?, S>> {
}
}
}

View File

@@ -0,0 +1,107 @@
/*
* Copyright 2016-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.util;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>> {
static <T> Streamable<T> empty() {
return null;
}
static <T> Streamable<T> of(T... t) {
return null;
}
static <T> Streamable<T> of(Iterable<T> iterable) {
return null;
}
static <T> Streamable<T> of(Supplier<? extends Stream<T>> supplier) {
return null;
}
default Stream<T> stream() {
return null;
}
default <R> Streamable<R> map(Function<? super T, ? extends R> mapper) {
return null;
}
default <R> Streamable<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper) {
return null;
}
default Streamable<T> filter(Predicate<? super T> predicate) {
return null;
}
default boolean isEmpty() {
return false;
}
default Streamable<T> and(Supplier<? extends Stream<? extends T>> stream) {
return null;
}
default Streamable<T> and(T... others) {
return null;
}
default Streamable<T> and(Iterable<? extends T> iterable) {
return null;
}
default Streamable<T> and(Streamable<? extends T> streamable) {
return null;
}
default List<T> toList() {
return null;
}
default Set<T> toSet() {
return null;
}
default Stream<T> get() {
return null;
}
public static <S> Collector<S, ?, Streamable<S>> toStreamable() {
return null;
}
public static <S, T extends Iterable<S>> Collector<S, ?, Streamable<S>> toStreamable(
Collector<S, ?, T> intermediate) {
return null;
}
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cache;
import java.util.concurrent.Callable;
import org.springframework.lang.Nullable;
public interface Cache {
String getName();
Object getNativeCache();
ValueWrapper get(Object key);
<T> T get(Object key, @Nullable Class<T> type);
<T> T get(Object key, Callable<T> valueLoader);
void put(Object key, @Nullable Object value);
default ValueWrapper putIfAbsent(Object key, @Nullable Object value) {
return null;
}
void evict(Object key);
default boolean evictIfPresent(Object key) {
return false;
}
void clear();
default boolean invalidate() {
return false;
}
interface ValueWrapper {
Object get();
}
class ValueRetrievalException extends RuntimeException {
public ValueRetrievalException(@Nullable Object key, Callable<?> loader, Throwable ex) {
}
public Object getKey() {
return null;
}
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ui;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.springframework.lang.Nullable;
public class ConcurrentModel extends ConcurrentHashMap<String, Object> implements Model {
public ConcurrentModel() {
}
public ConcurrentModel(String attributeName, Object attributeValue) {
}
public ConcurrentModel(Object attributeValue) {
}
@Override
public Object put(String key, @Nullable Object value) {
return null;
}
@Override
public void putAll(Map<? extends String, ?> map) {
}
@Override
public ConcurrentModel addAttribute(String attributeName, @Nullable Object attributeValue) {
return null;
}
@Override
public ConcurrentModel addAttribute(Object attributeValue) {
return null;
}
@Override
public ConcurrentModel addAllAttributes(@Nullable Collection<?> attributeValues) {
return null;
}
@Override
public ConcurrentModel addAllAttributes(@Nullable Map<String, ?> attributes) {
return null;
}
@Override
public ConcurrentModel mergeAttributes(@Nullable Map<String, ?> attributes) {
return null;
}
@Override
public boolean containsAttribute(String attributeName) {
return false;
}
@Override
public Object getAttribute(String attributeName) {
return null;
}
@Override
public Map<String, Object> asMap() {
return null;
}
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ui;
import java.util.Collection;
import java.util.Map;
import org.springframework.lang.Nullable;
public interface Model {
Model addAttribute(String attributeName, @Nullable Object attributeValue);
Model addAttribute(Object attributeValue);
Model addAllAttributes(Collection<?> attributeValues);
Model addAllAttributes(Map<String, ?> attributes);
Model mergeAttributes(Map<String, ?> attributes);
boolean containsAttribute(String attributeName);
Object getAttribute(String attributeName);
Map<String, Object> asMap();
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ui;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.lang.Nullable;
public class ModelMap extends LinkedHashMap<String, Object> {
public ModelMap() {
}
public ModelMap(String attributeName, @Nullable Object attributeValue) {
}
public ModelMap(Object attributeValue) {
}
public ModelMap addAttribute(String attributeName, @Nullable Object attributeValue) {
return null;
}
public ModelMap addAttribute(Object attributeValue) {
return null;
}
public ModelMap addAllAttributes(@Nullable Collection<?> attributeValues) {
return null;
}
public ModelMap addAllAttributes(@Nullable Map<String, ?> attributes) {
return null;
}
public ModelMap mergeAttributes(@Nullable Map<String, ?> attributes) {
return null;
}
public boolean containsAttribute(String attributeName) {
return false;
}
public Object getAttribute(String attributeName) {
return null;
}
}