Skip to content

Commit

Permalink
[type:feat] init sdk starter. (apache#3930)
Browse files Browse the repository at this point in the history
* [type:feat] add new shenyu-sdk.

* [type:feat] java sdk module init.

* [type:feat] java sdk module init.

* [type:feat] init sdk starter.

* [type:feat] init sdk starter.

* [type:feat] modify sdk starter.

* [type:feat] modify sdk starter.

* [type:feat] init sdk starter.

* [type:feat] init sdk starter.

* [type:feat] init sdk starter.

* [type:feat] init sdk starter.

* [type:feat] init sdk starter.

* [type:feat] move sdk .
  • Loading branch information
yunlongn authored Sep 9, 2022
1 parent 443fb4a commit cf7cac4
Show file tree
Hide file tree
Showing 32 changed files with 2,551 additions and 278 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import java.util.HashMap;
import org.apache.shenyu.common.constant.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -43,6 +42,7 @@
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

Expand Down Expand Up @@ -143,6 +143,23 @@ public static Map<String, Object> jsonToMap(final String json) {
}
}

/**
* String to Object.
*
* @param json the object
* @param valueTypeRef class
* @param <T> generic
* @return the converted map
*/
public static <T> T jsonToObject(final String json, final Class<T> valueTypeRef) {
try {
return MAPPER.readValue(json, valueTypeRef);
} catch (IOException e) {
LOG.warn("write to Object error: " + json, e);
return null;
}
}

/**
* Remove class object.
*
Expand Down
13 changes: 6 additions & 7 deletions shenyu-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@

<artifactId>shenyu-sdk</artifactId>

<packaging>pom</packaging>
<modules>
<module>shenyu-sdk-core</module>
<module>shenyu-sdk-spring</module>
</modules>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-spi</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
43 changes: 43 additions & 0 deletions shenyu-sdk/shenyu-sdk-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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
~
~ http://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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>shenyu-sdk</artifactId>
<groupId>org.apache.shenyu</groupId>
<version>2.5.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>shenyu-sdk-core</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.shenyu</groupId>
<artifactId>shenyu-spi</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.shenyu.sdk.core;

import org.apache.shenyu.sdk.core.common.RequestTemplate;

import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
Expand Down
Loading

0 comments on commit cf7cac4

Please sign in to comment.