Giter Site home page Giter Site logo

appversionframework's Introduction

AppVersionFramework

项目名称

移动应用版本管理

项目介绍

在移动应用开发中,一定会面临APP版本升级带来的后端的实现代码版本的变化,但很多时候只是部分接口方法变更,而不是所有,因此需要一个架构统一对后端的实现 代码进行版本管理。本方案即尝试解决这个问题。目前已实现支持多应用、多版本管理,支持新、旧版本的切换。

使用说明

1、通过构建VersionManager类实现版本管理。 2、应用的需求实现,可以有两种方式,一种是直接继承AbstractCommand,重写execute方法,但使用这种方法不支持版本号,只能通过名称找到命令;二是实现BaseAction类,使用annotation标记命令信息。

示例1:

package com.laudandjolynn.avf.action1;

import com.laudandjolynn.avf.cmd.AbstractCommand;
import com.laudandjolynn.avf.cmd.Parameter;

/**
 * @author: Laud
 * @email: [email protected]
 * @date: 2014-2-19 下午3:37:46
 * @copyright: avf.laudandjolynn.com
 * 
 */
public class TestCommand extends AbstractCommand {

	@Override
	public Object execute(Parameter parameter) {
	  //具体实现
		return null;
	}

}

示例2:

package com.laudandjolynn.avf.action1;

import com.laudandjolynn.avf.BaseAction;
import com.laudandjolynn.avf.annotation.Action;
import com.laudandjolynn.avf.annotation.ActionCmdDefine;

/**
 * @author: Laud
 * @email: [email protected]
 * @date: 2014-2-19 下午3:37:46
 * @copyright: avf.laudandjolynn.com
 */
@Action(name = "TestAction1", version = "1.0")
public class Action1 extends BaseAction {
	@ActionCmdDefine(name = "action1")
	public void action1() {
		System.out.println(Action1.class.getName() + ",action1");
	}

	@ActionCmdDefine(name = "action2", namespace = "test_namespace2")
	public void action2() {
		System.out.println(Action1.class.getName()
				+ ",test_namespace2.action2");
	}
}

package com.laudandjolynn.avf.action2;

import com.laudandjolynn.avf.BaseAction;
import com.laudandjolynn.avf.annotation.Action;
import com.laudandjolynn.avf.annotation.ActionCmdDefine;

/**
 * @author: Laud
 * @email: [email protected]
 * @date: 2014-2-19 下午3:37:46
 * @copyright: avf.laudandjolynn.com
 */
@Action(name = "TestAction2", version = "1.1", refVersion = "1.0")
public class Action2 extends BaseAction {
	@ActionCmdDefine(name = "action1", refVersion = "1.1")
	public void action1() {
		System.out.println(Action2.class.getName() + ",action1");
	}

	/**
	 * 此指令指向1.0版本的,namespace="test_namespace2"的action2指令
	 */
	@ActionCmdDefine(name = "action2", namespace = "test_namespace2", refVersion = "1.0")
	public void action2() {
	}
}

VersionManager构造方式及使用:

Application app = new Application("test", "1.0");
String[] versions = new String[] { "1.0", "1.1" };
VersionManager vm = new VersionManager(app, versions);
Command command = vm.getCommand("1.0", null, "action1");
command = vm.getCommand("1.1", null, "action1");
command = vm.getCommand("1.0", "test_namespace2", "action2");
command = vm.getCommand("1.1", "test_namespace2", "action2");

appversionframework's People

Contributors

52jolynn avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.