Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
FAQ
License

Custom properties



The CustomProperties interface allows to specify custom properties. Custom properties are usable both on the command-line and configuration file.

Note that if you define some of these properties in the command-line, they will be parsed only if you define them after specifying the docx output type. For example, this will not work:
      java -jar docGenerator.jar -input=wiki/input -output=wiki/output -hasTOC=false -outputType=docx
But this will work:
      java -jar docGenerator.jar -input=wiki/input -output=wiki/output -outputType=docx -hasTOC=false

Implementing custom properties

The CustomProperties interface has the following methods:
   public interface CustomProperties {
   /**
   * Return true if a specified property key is handled.
   */
   public default boolean hasProperty(String key) {
   return getPropertiesTypes().containsKey(key);
   } 

   /**
   * Return the Map of properties types.
   */
   public Map<String, Class<?>> getPropertiesTypes();

   /**
   * Set the value of a specified property.
   */
   public void setProperty(String key, Object value);

   /**
   * Return the value of a specified property.
   */
   public Object getProperty(String key);

   /**
   * Reset the properties.
   */
   public void reset();

   /**
   * Setup the class after all the properties have been set.
   */
   public void setup();

   /**
   * Set the parent parser which can be notified if an exception is detected while settting the property.
   */
   public void setParser(ResolverXMLParser parser);

   /**
   * Set the ClassLoader used for the properties.
   */
   public void setClassLoader(ClassLoader loader);      

Property types

The CustomProperties.getPropertiesTypes() method allows to get the property keys and the class of each property. The supported types are:
  • Boolean.TYPE and Boolean.class for boolean properties
  • Integer.TYPE and Integer.class for int properties
  • Float.TYPE and Float.class for float properties
  • URL.class for File properties
Each property detected on the command-line or the configuration file will be parsed according to its specified type.

See also


Categories: plugins

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.