forked from demo/example
richie
6 years ago
6 changed files with 121 additions and 0 deletions
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<assembly> |
||||
<id>Project.release</id> |
||||
<formats> |
||||
<format>zip</format> |
||||
</formats> |
||||
<includeBaseDirectory>true</includeBaseDirectory> |
||||
<fileSets> |
||||
<fileSet> |
||||
<directory>target/classes</directory> |
||||
<outputDirectory>/bin</outputDirectory> |
||||
</fileSet> |
||||
</fileSets> |
||||
<dependencySets> |
||||
<dependencySet> |
||||
<useProjectArtifact>true</useProjectArtifact> |
||||
<outputDirectory>/</outputDirectory> |
||||
<scope>runtime</scope> |
||||
</dependencySet> |
||||
</dependencySets> |
||||
</assembly> |
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin> |
||||
<id>com.fr.plugin.test</id> |
||||
<name><![CDATA[测试函数插件]]></name> |
||||
<active>yes</active> |
||||
<version>1.0</version> |
||||
<env-version>10.0</env-version> |
||||
<jartime>2018-07-31</jartime> |
||||
<vendor>author</vendor> |
||||
<description><![CDATA[可以把一组数组都求绝对值]]></description> |
||||
<change-notes><![CDATA[ |
||||
[2018-08-01]修改一点问题。<br/> |
||||
[2018-07-31]初始化插件。<br/> |
||||
]]></change-notes> |
||||
<extra-core> |
||||
<FunctionDefineProvider class="com.fr.plugin.MyAbs" name="MyAbs" description="求绝对值,支持数组。"/> |
||||
</extra-core> |
||||
</plugin> |
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<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"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<parent> |
||||
<groupId>com.fr.plugin</groupId> |
||||
<artifactId>plugins</artifactId> |
||||
<version>1.0</version> |
||||
</parent> |
||||
<packaging>jar</packaging> |
||||
<artifactId>plugin-function</artifactId> |
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-assembly-plugin</artifactId> |
||||
<version>2.5.4</version> |
||||
<executions> |
||||
<execution> |
||||
<id>make-zip</id> |
||||
<phase>install</phase> |
||||
<goals> |
||||
<goal>single</goal> |
||||
</goals> |
||||
</execution> |
||||
</executions> |
||||
<configuration> |
||||
<appendAssemblyId>false</appendAssemblyId> |
||||
<descriptors> |
||||
<descriptor>build/assembly/zip.xml</descriptor> |
||||
</descriptors> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</project> |
@ -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<Double> result = new FArray<Double>(); |
||||
for (Object arg : args) { |
||||
result.add(GeneralUtils.objectToNumber(arg).doubleValue()); |
||||
} |
||||
} |
||||
return Primitive.ERROR_VALUE; |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<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"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<parent> |
||||
<groupId>com.fr.plugin</groupId> |
||||
<artifactId>starter</artifactId> |
||||
<version>1.0</version> |
||||
</parent> |
||||
<packaging>pom</packaging> |
||||
<artifactId>plugins</artifactId> |
||||
<modules> |
||||
<module>plugin-function</module> |
||||
</modules> |
||||
</project> |
Loading…
Reference in new issue