All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.cuioss.tools.formatting.package-info Maven / Gradle / Ivy

Go to download

Utility Library acting as a replacement for googles guava, certain apache-commons libraries and logging facades/frameworks.

There is a newer version: 2.1.1
Show newest version
/**
 * 

Configurable formatting for complex structures

*

The Problem

*

* Provide a text representation for given complex object. As a plus the * formatting should be easily configurable with a simple DSL-style template * language. *

The Solution

*

* The {@link de.cuioss.tools.formatting} framework presented here. *

*

* The starting point is * {@link de.cuioss.tools.formatting.template.FormatterSupport} providing two * methods: *

    *
  • {@link de.cuioss.tools.formatting.template.FormatterSupport#getSupportedPropertyNames()}: * Provides the property names that can be used for formatting
  • *
  • {@link de.cuioss.tools.formatting.template.FormatterSupport#getAvailablePropertyValues()}: * Provides a name with with the supported names and values.
  • *
*

* The other interface needed is * {@link de.cuioss.tools.formatting.template.TemplateFormatter} defining the * method * {@link de.cuioss.tools.formatting.template.TemplateFormatter#format(de.cuioss.tools.formatting.template.FormatterSupport)} * doing the actual formatting. *

*

Sample

Dto PersonName implementing * {@link de.cuioss.tools.formatting.template.FormatterSupport} * *
 * 

 final PersonName personName = PersonName.builder()
 .setFamilyName("Fischers")
 .setGivenName("Fritz")
 .setMiddleName("Felix")
 .setGivenNameSuffix("Dr.")
 .build();

 final TemplateFormatter<PersonName> formatter = TemplateFormatterImpl.builder()
 .useTemplate("[familyName], [givenName], [middleName] [givenNameSuffix]")
 .forType(PersonName.class);

 assertEquals("Fischers, Fritz, Felix Dr.", formatter.format(personName));
 * 
 *
 * 
* */ package de.cuioss.tools.formatting;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy