Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
public class TypeConfiguration implements Serializable {
    /** Serial version UID. */
    private static final long serialVersionUID = 0L;
 
    /** Type name. Supports wildcards. **/
    private String typeName;
 
    /**
     * Package name. When set, configuration will be applied to all classes inside the package 
     * (unless overriden in more specific TypeConfiguration). 
     * Applicable only for cases when classes exists in node classpath.
     * TypeInfo implementations are free to decide whether they support packages or not.
     */
    private String typeNamepackageName;

    /** Affinity key field name. */
    private String affKeyFieldName;

    /** Type info extensions. */
    private Map<Class<? extends TypeInfo>, ? extends TypeInfo> typeInfos;
 
    public void setTypeInfos(Collection<? extends TypeInfo>setTypeInfo(TypeInfo... typeInfos) {...}
 
    public Collection<? extends TypeInfo> getTypeInfosTypeInfo[] getTypeInfo() {...}
 
    public <T extends TypeInfo> T getTypeInfo(Class<T> infoCls) {...}
}

Notes:

  • We wanted to have package wildcards in typeName. E.g. "org.my.package.*". This is prone to errors and it is better to allow user select whether this is config for a single type or for a package explicitly;
  • TypeInfo's are set as varargs to follow general Ignite rules (e.g. IgniteConfiguration.setCacheConfiguration()).
  • TypeInfo getter/setter do not have "s" at the end to follow general Ignite rules (e.g. IgniteConfiguration.setCacheConfiguration());

TypeInfo

Code Block
languagejava
public interface TypeInfo extends Serializable {
    /** Whether implemenation supports single type. */
  *
  bool supportSingleType();
 
    /** Whether implementation supports packages. */
public interface TypeInfo extends Serializable {
}bool supportPackage();
}

Notes:

  • Package configuration are only supported by PortableTypeInfo for now. For this reason it makes sense to add "support*" methods to this interface to prevent misconfiguration.

 

Code Block
languagejava
/**
 *
 */
public class PersistenceTypeInfo implements TypeInfo {
    /** Serial version UID. */
    private static final long serialVersionUID = 0L;

    /** Schema name in database. */
    private String dbSchema;

    /** Table name in database. */
    private String dbTbl;

    /** Persisted fields. */
    @GridToStringInclude
    private Collection<PersistenceFieldInfo> fields;
}

...