private static Property[] extractAnnotatedProperties(final AbstractPlugin plugin) { final Plugin pluginAnnotation = plugin.getClass().getAnnotation(Plugin.class); if (pluginAnnotation != null) { return pluginAnnotation.configuration(); } return new Property[0]; }
private static Property[] extractAnnotatedProperties(final AbstractPlugin plugin) { final Plugin pluginAnnotation = plugin.getClass().getAnnotation(Plugin.class); if (pluginAnnotation != null) { return pluginAnnotation.configuration(); } return new Property[0]; }
/** * Checks whether the property with the given name is marked as updateable. * * @param propertyName * Name of the property to check * @return true if marked as updateable, else false. */ public boolean isPropertyUpdateable(final String propertyName) { final Plugin pluginAnnotations = this.getClass().getAnnotation(Plugin.class); final Property[] properties = pluginAnnotations.configuration(); final List<Property> propertyList = Arrays.asList(properties); for (final Property p : propertyList) { if (p.name().equals(propertyName)) { return p.updateable(); } } return false; }
private Property[] getExpectedProperties(final Class<?> clazz) { final Plugin pluginAnnotation = clazz.getAnnotation(Plugin.class); if (pluginAnnotation != null) { return pluginAnnotation.configuration(); } else { return new Property[0]; } }
/** * Checks whether the property with the given name is marked as updateable. * * @param propertyName * Name of the property to check * @return true if marked as updateable, else false. */ public boolean isPropertyUpdateable(final String propertyName) { final Plugin pluginAnnotations = this.getClass().getAnnotation(Plugin.class); final Property[] properties = pluginAnnotations.configuration(); final List<Property> propertyList = Arrays.asList(properties); for (final Property p : propertyList) { if (p.name().equals(propertyName)) { return p.updateable(); } } return false; }
/** * This method delivers an instance of {@code Configuration} containing the default properties for this class. * * @return The default properties. */ @Override protected final Configuration getDefaultConfiguration() { final Configuration defaultConfiguration = new Configuration(); // Get the annotation from the class final Plugin pluginAnnotation = this.getClass().getAnnotation(Plugin.class); final Property[] propertyAnnotations = pluginAnnotation.configuration(); // Run through all properties within the annotation and add them to the configuration object for (final Property property : propertyAnnotations) { defaultConfiguration.setProperty(property.name(), property.defaultValue()); } return defaultConfiguration; }
/** * This method delivers an instance of {@code Configuration} containing the default properties for this class. * * @return The default properties. */ @Override protected final Configuration getDefaultConfiguration() { final Configuration defaultConfiguration = new Configuration(); // Get the annotation from the class final Plugin pluginAnnotation = this.getClass().getAnnotation(Plugin.class); final Property[] propertyAnnotations = pluginAnnotation.configuration(); // Run through all properties within the annotation and add them to the configuration object for (final Property property : propertyAnnotations) { defaultConfiguration.setProperty(property.name(), property.defaultValue()); } return defaultConfiguration; }