From d626676bb74aea3d75469e34372de0fe1c1cfb7c Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 31 Jul 2018 19:02:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin-function/build/assembly/zip.xml | 21 ++++++++++ plugins/plugin-function/plugin.xml | 17 +++++++++ plugins/plugin-function/pom.xml | 38 +++++++++++++++++++ .../src/main/java/com/fr/plugin/MyAbs.java | 25 ++++++++++++ plugins/pom.xml | 17 +++++++++ pom.xml | 3 ++ 6 files changed, 121 insertions(+) create mode 100644 plugins/plugin-function/build/assembly/zip.xml create mode 100644 plugins/plugin-function/plugin.xml create mode 100644 plugins/plugin-function/pom.xml create mode 100644 plugins/plugin-function/src/main/java/com/fr/plugin/MyAbs.java create mode 100644 plugins/pom.xml diff --git a/plugins/plugin-function/build/assembly/zip.xml b/plugins/plugin-function/build/assembly/zip.xml new file mode 100644 index 0000000..11da522 --- /dev/null +++ b/plugins/plugin-function/build/assembly/zip.xml @@ -0,0 +1,21 @@ + + + Project.release + + zip + + true + + + target/classes + /bin + + + + + true + / + runtime + + + \ No newline at end of file diff --git a/plugins/plugin-function/plugin.xml b/plugins/plugin-function/plugin.xml new file mode 100644 index 0000000..a7553ec --- /dev/null +++ b/plugins/plugin-function/plugin.xml @@ -0,0 +1,17 @@ + + com.fr.plugin.test + + yes + 1.0 + 10.0 + 2018-07-31 + author + + + [2018-07-31]初始化插件。
+ ]]>
+ + + +
\ No newline at end of file diff --git a/plugins/plugin-function/pom.xml b/plugins/plugin-function/pom.xml new file mode 100644 index 0000000..5741a87 --- /dev/null +++ b/plugins/plugin-function/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + + com.fr.plugin + plugins + 1.0 + + jar + plugin-function + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.4 + + + make-zip + install + + single + + + + + false + + build/assembly/zip.xml + + + + + + \ No newline at end of file diff --git a/plugins/plugin-function/src/main/java/com/fr/plugin/MyAbs.java b/plugins/plugin-function/src/main/java/com/fr/plugin/MyAbs.java new file mode 100644 index 0000000..6e2b94a --- /dev/null +++ b/plugins/plugin-function/src/main/java/com/fr/plugin/MyAbs.java @@ -0,0 +1,25 @@ +package com.fr.plugin; + +import com.fr.general.FArray; +import com.fr.general.GeneralUtils; +import com.fr.script.AbstractFunction; +import com.fr.stable.ArrayUtils; +import com.fr.stable.Primitive; + +public class MyAbs extends AbstractFunction { + + public Object run(Object[] args) { + int len = ArrayUtils.getLength(args); + if (len == 0) { + return Primitive.ERROR_VALUE; + } else if (len == 1) { + return Math.abs(GeneralUtils.objectToNumber(args[0]).doubleValue()); + } else { + FArray result = new FArray(); + for (Object arg : args) { + result.add(GeneralUtils.objectToNumber(arg).doubleValue()); + } + } + return Primitive.ERROR_VALUE; + } +} diff --git a/plugins/pom.xml b/plugins/pom.xml new file mode 100644 index 0000000..7f90545 --- /dev/null +++ b/plugins/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + com.fr.plugin + starter + 1.0 + + pom + plugins + + plugin-function + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index ae29149..1999707 100644 --- a/pom.xml +++ b/pom.xml @@ -8,6 +8,9 @@ 10.0-RELEASE-SNAPSHOT + + plugins +