## org.eclipse.ocl.lpg
Class AbstractFormattingHelper

    java.lang.Object
      org.eclipse.ocl.lpg.AbstractFormattingHelper

All Implemented Interfaces:
  FormattingHelper

    public class AbstractFormattingHelper

extends Object
implements FormattingHelper

Some default formatting algorithms with support for some basic OCL and Ecore constructs.

Since:
  1.2

Field Summary
`static AbstractFormattingHelper` `INSTANCE` Shared instance implementing the default formatting algorithms.

Constructor Summary
`AbstractFormattingHelper()`

Method Summary
`String` `formatClass(Object object)` Return the Java class name of object. e.g.
`String` `formatEClassName(EObject eObject)` Return the Ecore class name of object. e.g.
`String` `formatName(Object object)` Return the name of object. e.g.
`String` `formatPath(List<String> pathName)` Return a hierarchical path name. e.g.
`String` `formatPath(List<String> pathName, String name)` Return a hierarchically named name. e.g.
`String` `formatQualifiedName(Object object)` Return the qualified name of an object. e.g.
`String` `formatString(String name)` Return the string. e.g.
`String` `formatType(Object type)` Return the type of object. e.g.
`protected String` `getSeparator()` Obtains the name of the separator between namespaces in a qualified name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INSTANCE

    public static final AbstractFormattingHelper INSTANCE

  Shared instance implementing the default formatting algorithms.

Constructor Detail

### AbstractFormattingHelper

    public AbstractFormattingHelper()

Method Detail

### formatClass

    public String formatClass(Object object)

  Description copied from interface: `FormattingHelper`
  Return the Java class name of object. e.g. "org.eclipse.ocl.FormattingHelper".

  Specified by:
    `formatClass` in interface `FormattingHelper`
  Parameters:
    `object` - to be formatted
  Returns:
    non-null string describing the class of object

### formatEClassName

    public String formatEClassName(EObject eObject)

  Description copied from interface: `FormattingHelper`
  Return the Ecore class name of object. e.g. "EOperation"

  Specified by:
    `formatEClassName` in interface `FormattingHelper`
  Returns:
    non-null string describing the Ecore class of object

### formatName

    public String formatName(Object object)

  Description copied from interface: `FormattingHelper`
  Return the name of object. e.g. "name". The name may be obtained by using known name methods such as ENamedElement.getName().

  Specified by:
    `formatName` in interface `FormattingHelper`
  Parameters:
    `object` - to be formatted
  Returns:
    non-null string describing the name of object

### getSeparator

    protected String getSeparator()

  Obtains the name of the separator between namespaces in a qualified name. The default separator is `"::"`.

  Returns:
    the namespace separator

### formatQualifiedName

    public String formatQualifiedName(Object object)

  Description copied from interface: `FormattingHelper`
  Return the qualified name of an object. e.g. "A::B::name".

  Specified by:
    `formatQualifiedName` in interface `FormattingHelper`
  Parameters:
    `object` - to be formatted
  Returns:
    non-null string describing the qualified name of the object

### formatPath

    public String formatPath(List<String> pathName)

  Description copied from interface: `FormattingHelper`
  Return a hierarchical path name. e.g. "A::B::C"

  Specified by:
    `formatPath` in interface `FormattingHelper`
  Parameters:
    `pathName` - to be formatted
  Returns:
    non-null string describing the pathName

### formatPath

    public String formatPath(List<String> pathName,
                             String name)

  Description copied from interface: `FormattingHelper`
  Return a hierarchically named name. e.g. "A::B::C.D"

  Specified by:
    `formatPath` in interface `FormattingHelper`
  Parameters:
    `pathName` - to be formatted
    `name` - to be suffixed
  Returns:
    non-null string describing the class of object

### formatString

    public String formatString(String name)

  Description copied from interface: `FormattingHelper`
  Return the string. e.g. "string"

  Specified by:
    `formatString` in interface `FormattingHelper`
  Parameters:
    `name` - to be formatted
  Returns:
    non-null string describing string

### formatType

    public String formatType(Object type)

  Description copied from interface: `FormattingHelper`
  Return the type of object. e.g. "Set(String)". The type may be obtained by using known type methods such as ETypedElement.getType().

  Specified by:
    `formatType` in interface `FormattingHelper`
  Returns:
    non-null string describing the type of object

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.