src/main/java/com/helger/genericode/Genericode10Helper.java
@Nonnull
  public static String getColumnElementID (@Nonnull final Object aColumnElement)
  {
    if (aColumnElement instanceof ColumnRef)
      return ((ColumnRef) aColumnElement).getId ();
    if (aColumnElement instanceof Column)
      return ((Column) aColumnElement).getId ();
    if (aColumnElement instanceof Key)
    {
      final List <KeyColumnRef> aKeyColumnRefs = ((Key) aColumnElement).getColumnRef ();
      final KeyColumnRef aKeyColumnRef = CollectionHelper.getFirstElement (aKeyColumnRefs);
      if (aKeyColumnRef == null)
        throw new IllegalArgumentException ("Key contains not KeyColumnRef!!");
      final Object aRef = aKeyColumnRef.getRef ();
      if (aRef instanceof Column)
        return ((Column) aRef).getId ();
      throw new IllegalArgumentException ("Unsupported referenced object: " +
                                          aRef +
                                          " - " +
                                          ClassHelper.getSafeClassName (aRef));
    }
    throw new IllegalArgumentException ("Illegal column element: " +
                                        aColumnElement +
                                        " - " +
                                        ClassHelper.getSafeClassName (aColumnElement));
  }
@Nonnull
  public static String getColumnElementID (@Nonnull final Object aColumnElement)
  {
    if (aColumnElement instanceof ColumnRef)
      return ((ColumnRef) aColumnElement).getId ();
    if (aColumnElement instanceof Column)
      return ((Column) aColumnElement).getId ();
    if (aColumnElement instanceof Key)
    {
      final List <KeyColumnRef> aKeyColumnRefs = ((Key) aColumnElement).getColumnRef ();
      final KeyColumnRef aKeyColumnRef = CollectionHelper.getFirstElement (aKeyColumnRefs);
      if (aKeyColumnRef == null)
        throw new IllegalArgumentException ("Key contains not KeyColumnRef!!");
      final Object aRef = aKeyColumnRef.getRef ();
      if (aRef instanceof Column)
        return ((Column) aRef).getId ();
      throw new IllegalArgumentException ("Unsupported referenced object: " +
                                          aRef +
                                          " - " +
                                          ClassHelper.getSafeClassName (aRef));
    }
    throw new IllegalArgumentException ("Illegal column element: " +
                                        aColumnElement +
                                        " - " +
                                        ClassHelper.getSafeClassName (aColumnElement));
  }
@ Nonnull public static String getColumnElementID ( @ Nonnull final Object aColumnElement ) { if ( aColumnElement instanceof ColumnRef ) return ( ( ColumnRef ) aColumnElement ) . getId ( ) ; if ( aColumnElement instanceof Column ) return ( ( Column ) aColumnElement ) . getId ( ) ; if ( aColumnElement instanceof Key ) { final List < KeyColumnRef > aKeyColumnRefs = ( ( Key ) aColumnElement ) . getColumnRef ( ) ; final KeyColumnRef aKeyColumnRef = CollectionHelper . getFirstElement ( aKeyColumnRefs ) ; if ( aKeyColumnRef == null ) throw new IllegalArgumentException ( "Key contains not KeyColumnRef!!" ) ; final Object aRef = aKeyColumnRef . getRef ( ) ; if ( aRef instanceof Column ) return ( ( Column ) aRef ) . getId ( ) ; throw new IllegalArgumentException ( "Unsupported referenced object: " + aRef + " - " + ClassHelper . getSafeClassName ( aRef ) ) ; } throw new IllegalArgumentException ( "Illegal column element: " + aColumnElement + " - " + ClassHelper . getSafeClassName ( aColumnElement ) ) ; }
Get the ID of the passed column element.

@param aColumnElement
The column element to use. Must be either a {@link ColumnRef} or a
{@link Column}.
@return The ID of the object
Get the ID of the passed column element .