Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a6084f710d90b0c780af6f49227c3fb80830313b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (c) 2004-2013 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.cdo.server.db.mapping;

import org.eclipse.emf.cdo.server.db.mapping.ITypeMapping.Provider;

import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.util.factory.ProductCreationException;

import org.eclipse.emf.ecore.EStructuralFeature;

/**
 * Can modify the column type of a {@link ITypeMapping type mapping} that is created by the {@link ITypeMapping.Registry type mapping registry}.
 *
 * @author Eike Stepper
 * @since 4.2
 */
public abstract class ColumnTypeModifier
{
  public static final ColumnTypeModifier NOOP = new ColumnTypeModifier()
  {
    @Override
    public DBType modify(Provider provider, IMappingStrategy mappingStrategy, EStructuralFeature feature, DBType dbType)
    {
      return dbType;
    }
  };

  public ColumnTypeModifier()
  {
  }

  /**
   * Can modify the column type of a {@link ITypeMapping type mapping} that is created by the {@link ITypeMapping.Registry type mapping registry}.
   */
  public abstract DBType modify(ITypeMapping.Provider provider, IMappingStrategy mappingStrategy,
      EStructuralFeature feature, DBType dbType);

  /**
   * Creates {@link ColumnTypeModifier} instances.
   *
   * @author Eike Stepper
   */
  public static abstract class Factory extends org.eclipse.net4j.util.factory.Factory
  {
    /**
     * The Net4j factory product group for column type modifiers.
     */
    public static final String PRODUCT_GROUP = "org.eclipse.emf.cdo.server.db.columnTypeModifiers";

    public Factory(String type)
    {
      super(PRODUCT_GROUP, type);
    }

    public abstract ColumnTypeModifier create(String description) throws ProductCreationException;
  }
}

Back to the top