Skip to content

Commit

Permalink
plugin sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Linyuzai committed Jul 8, 2024
1 parent 112d493 commit 09f77ab
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@Configuration
public class PluginConfig {

public static final String CLASS_NAME_FILTER = "com.github.linyuzai.concept.sample.plugin.**";
public static final String CLASS_NAME_FILTER = "com.example.jarplugin.sample.SampleCustomPlugin";

public static final String CLASS_NAME_SAMPLE_FILTER = "com.github.linyuzai.concept.sample.plugin.Sample**";
public static final String CLASS_NAME_SAMPLE_FILTER = CLASS_NAME_FILTER;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class SampleBeanArrayExtractor extends BeanExtractor<CustomPlugin[]> {

@Override
public void onExtract(@PluginClassName(PluginConfig.CLASS_NAME_FILTER) CustomPlugin[] plugins, PluginContext context) {
public void onExtract(CustomPlugin[] plugins, PluginContext context) {
log.info("Bean Array => {}", Arrays.toString(plugins));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class SampleBeanExtractor extends BeanExtractor<List<? extends CustomPlugin>> {
public class SampleBeanExtractor extends BeanExtractor<CustomPlugin> {

@Override
public void onExtract(@PluginClassName(PluginConfig.CLASS_NAME_FILTER) List<? extends CustomPlugin> plugins, PluginContext context) {
log.info("Bean Object => {}", plugins);
public void onExtract(CustomPlugin plugin, PluginContext context) {
log.info("Bean Object => {}", plugin);
plugin.run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class SampleBeanListExtractor extends BeanExtractor<List<? extends CustomPlugin>> {

@Override
public void onExtract(@PluginClassName(PluginConfig.CLASS_NAME_FILTER) List<? extends CustomPlugin> plugins, PluginContext context) {
public void onExtract( List<? extends CustomPlugin> plugins, PluginContext context) {
log.info("Bean List => {}", plugins);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class SampleBeanMapExtractor extends BeanExtractor<Map<Object, ? extends CustomPlugin>> {

@Override
public void onExtract(@PluginClassName(PluginConfig.CLASS_NAME_FILTER) Map<Object, ? extends CustomPlugin> plugins, PluginContext context) {
public void onExtract(Map<Object, ? extends CustomPlugin> plugins, PluginContext context) {
log.info("Bean Map => {}", plugins);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class SampleBeanSetExtractor extends BeanExtractor<Set<? extends CustomPlugin>> {

@Override
public void onExtract(@PluginClassName(PluginConfig.CLASS_NAME_FILTER) Set<? extends CustomPlugin> plugins, PluginContext context) {
public void onExtract(Set<? extends CustomPlugin> plugins, PluginContext context) {
log.info("Bean Set => {}", plugins);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.github.linyuzai.concept.sample.plugin.v2.prop;

import com.github.linyuzai.plugin.core.context.PluginContext;
import com.github.linyuzai.plugin.core.handle.extract.PropertiesExtractor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.Properties;

@Slf4j
@Component
public class SamplePropertiesArrayExtractor extends PropertiesExtractor<Properties[]> {

@Override
public void onExtract(Properties[] plugins, PluginContext context) {
log.info("Properties Array => {}", Arrays.toString(plugins));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.github.linyuzai.concept.sample.plugin.v2.prop;

import com.github.linyuzai.plugin.core.context.PluginContext;
import com.github.linyuzai.plugin.core.handle.extract.PropertiesExtractor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Properties;

@Slf4j
@Component
public class SamplePropertiesExtractor extends PropertiesExtractor<Properties> {

@Override
public void onExtract(Properties plugin, PluginContext context) {
log.info("Properties Object => {}", plugin);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.github.linyuzai.concept.sample.plugin.v2.prop;

import com.github.linyuzai.plugin.core.context.PluginContext;
import com.github.linyuzai.plugin.core.handle.extract.PropertiesExtractor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Properties;

@Slf4j
@Component
public class SamplePropertiesListExtractor extends PropertiesExtractor<List<Properties>> {

@Override
public void onExtract(List<Properties> plugins, PluginContext context) {
log.info("Properties List => {}", plugins);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.github.linyuzai.concept.sample.plugin.v2.prop;

import com.github.linyuzai.plugin.core.context.PluginContext;
import com.github.linyuzai.plugin.core.handle.extract.PropertiesExtractor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.Properties;

@Slf4j
@Component
public class SamplePropertiesMapExtractor extends PropertiesExtractor<Map<Object, Properties>> {

@Override
public void onExtract(Map<Object, Properties> plugins, PluginContext context) {
log.info("Properties Map => {}", plugins);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.github.linyuzai.concept.sample.plugin.v2.prop;

import com.github.linyuzai.plugin.core.context.PluginContext;
import com.github.linyuzai.plugin.core.handle.extract.PropertiesExtractor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Properties;
import java.util.Set;

@Slf4j
@Component
public class SamplePropertiesSetExtractor extends PropertiesExtractor<Set<Properties>> {

@Override
public void onExtract(Set<Properties> plugins, PluginContext context) {
log.info("Properties Set => {}", plugins);
}
}

0 comments on commit 09f77ab

Please sign in to comment.