oop - Pattern name for 'formatting' objects -


i have order value object getters. pass object formatter class creates specific array structure using getters. array encoded json , sent remote url.

there different urls require different array structures have created multiple formatter classes build respective arrays. in way these formatters 'wrap' original object not have public getter method exposing original object formatter. there 1 single public method exposed in each formatter called format.

could these formatters described decorator/wrapper patterns or pattern @ all? im not explicitly looking apply patterns sake of it, i've discovered using other patterns in other parts of code , renamed them appropriately less confusion.

consider visitor pattern. visitor allows 1 or more operations applied set of objects @ runtime, decoupling operations object structure.

visitor used in compilers. once abstract syntax tree(object structure) created, can traverse ast different purposes. in case objectstructure can order class , different purposes mirrors different formatters.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -