1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/ibsm-ibsm-common

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
В этом репозитории не указан файл с открытой лицензией (LICENSE). При использовании обратитесь к конкретному описанию проекта и его зависимостям в коде.
Клонировать/Скачать
Внести вклад в разработку кода
Синхронизировать код
Отмена
Подсказка: Поскольку Git не поддерживает пустые директории, создание директории приведёт к созданию пустого файла .keep.
Loading...
README.md

Часто используемые инструменты: сборник

  1. Унифицированная обработка для веб-бэкенда
package com.hm.car.util;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

import com.hm.common.ServerResponse;

/**
 * @author shishun.wang
 * @date 2016年12月15日 下午12:00:07
 * @version 1.0
 * @describe
 */
public class ControllerResult<T> {

    public static <T> ResponseEntity<ServerResponse<T>> success(T result) {
        return new ResponseEntity<ServerResponse<T>>(new ServerResponse<T>().success(result), HttpStatus.OK);
    }

    public static <T> ResponseEntity<ServerResponse<T>> failed(String message) {
        return new ResponseEntity<ServerResponse<T>>(new ServerResponse<T>().failure(message), HttpStatus.BAD_REQUEST);
    }

    public static <T> ResponseEntity<ServerResponse<T>> failed(Exception e) {
        return new ResponseEntity<ServerResponse<T>>(new ServerResponse<T>().failure(e.getMessage()),
                HttpStatus.BAD_REQUEST);
    }
}
  1. Быстрое копирование данных модели Java
package com.hm.car.util;

import java.lang.reflect.Field;
import java.util.Arrays;

import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.util.ReflectionUtils;

import com.hm.common.util.CommonUtil;

/**
 * @author shishun.wang
 * @date 2016年12月14日 上午10:11:15
 * @version 1.0
 * @describe
 */
public class BeanUtil {

    private static final String MODEL_ID_FIELD = "id";
    
    public static final void copyProperties(Object source, Object target, String... ignoreProperties) {
        if (com.hm.common.util.CommonUtil.isAnyEmpty(source, target)) {
            return;
        }
        BeanUtils.copyProperties(source, target, ignoreProperties);
        // Trying copy id field
        if (com.hm.common.util.CommonUtil.isNotEmpty(ignoreProperties) && Arrays.asList(ignoreProperties).contains(MODEL_ID_FIELD)) {
            return;
        }
        Field targetFiled = ReflectionUtils.findField(target.getClass(), MODEL_ID_FIELD, String.class);
        if (targetFiled == null) {
            return;
        }
        Field sourceFiled = ReflectionUtils.findField(source.getClass(), MODEL_ID_FIELD);
        if (sourceFiled == null) {
            return;
        }
        try {
            sourceFiled.setAccessible(true);
            Object sourceId = sourceFiled.get(source);
            if (sourceId == null) {
                return;
            }
            targetFiled.setAccessible(true);
            if (sourceId instanceof String) {
                ReflectionUtils.setField(targetFiled, target, sourceId);
            } else {
                ReflectionUtils.setField(targetFiled, target, sourceId.toString());
            }
        } catch (IllegalArgumentException | IllegalAccessException e) {
            LoggerFactory.getLogger(CommonUtil.class).error("Failed to reflect set id properties", e);
        }

    }
}
  1. Конфигурация проекта Maven
<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  
  <pluginGroups>
  </pluginGroups>
  <proxies></proxies>
  <servers>
    <server>  
      <id>nexus-releases</id>  
      <username>deployment</username>  
      <password>1234567</password>  
    </server>  
    <server>  
      <id>nexus-snapshots</id>  
      <username>deployment</username>  
      <password>1234567</password>  
    </server> 
    
    <server>  
      <id>hm-snapshots</id>  
      <username>admin</username>  
      <password>1234567</password>  
    </server>
  </servers>

  <mirrors>
      <mirror>
        <id>nexus-snapshots</id>
        <mirrorOf>nexus-snapshots</mirrorOf>
        <url>http://192.168.3.100:8888/nexus/content/groups/public-snapshots</url>
      </mirror>

      <mirror>
        <id>nexus-releases</id>
        <mirrorOf>nexus-releases</mirrorOf>
        <url>http://192.168.3.100:8888/nexus/content/groups/public</url>
      </mirror>
      
      <mirror>
        <id>hm-snapshots</id>
``` ```
<releases><enabled>false</enabled></releases>
        </pluginRepository>
        
        <pluginRepository>
            <id>hm-snapshots</id>
            <name>hm-snapshots</name>
            <url>http://120.92.147.60:8081/nexus/content/repositories/hm-snapshots</url>
            <snapshots><enabled>true</enabled></snapshots>
            <releases><enabled>true</enabled></releases>
        </pluginRepository>

        <pluginRepository>
            <id>thirdparty</id>
            <name>thirdparty</name>
            <url>http://120.92.147.60:8081/nexus/content/repositories/thirdparty</url>
            <snapshots><enabled>true</enabled></snapshots>
            <releases><enabled>true</enabled></releases>
        </pluginRepository>
        
      </pluginRepositories>
    </profile>
    
  </profiles>
<!---->

</settings>

В этом тексте описывается конфигурация репозиториев плагинов в системе сборки Maven. В нём определяются два репозитория: «hm-snapshots» и «thirdparty». Для каждого из них указываются идентификатор, имя, URL-адрес и настройки включения снимков (snapshots) и релизов (releases).

Комментарии ( 0 )

Вы можете оставить комментарий после Вход в систему

Введение

**Резюме часто используемых функций инструментов разработки, компонентов бизнес-логики и кода функциональности плагинов.** Цель — решить задачи, возникающие в ходе реальной повседневной работы, применяя подходящие методы для эффективной и качественной реализации бизнес-функций в установленные сроки. [Например: Jpush, Email, Али Плюс, распределё... Развернуть Свернуть
Отмена

Обновления (1)

все

Участники

все

Недавние действия

Загрузить больше
Больше нет результатов для загрузки
1
https://api.gitlife.ru/oschina-mirror/ibsm-ibsm-common.git
git@api.gitlife.ru:oschina-mirror/ibsm-ibsm-common.git
oschina-mirror
ibsm-ibsm-common
ibsm-ibsm-common
master