001: /*
002: * Copyright (c) 1998 - 2005 Versant Corporation
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * Versant Corporation - initial API and implementation
010: */
011: package com.versant.core.common;
012:
013: import com.versant.core.metadata.FieldMetaData;
014:
015: import java.util.Comparator;
016:
017: /**
018: * Meta data for a persistent or transactional field.
019: */
020: public interface VersantFieldMetaData {
021:
022: /**
023: * Return the fully qualified name of this field.
024: */
025: public String getQName();
026:
027: /**
028: * The name of the field.
029: */
030: public String getName();
031:
032: /**
033: * The absolute fieldNo for this field.
034: */
035: public int getManagedFieldNo();
036:
037: /**
038: * Is this an ordered collection?
039: */
040: public boolean isOrdered();
041:
042: /**
043: * Is the element type (or value for maps) a persistent class?
044: */
045: public boolean isElementTypePC();
046:
047: /**
048: * Is this a map with a persistent class key?
049: */
050: public boolean isKeyTypePC();
051:
052: /**
053: * The type stored in the collection or the value type for a map or the
054: * component type for an array.
055: */
056: public Class getElementType();
057:
058: /**
059: * The key type (null if not a map).
060: */
061: public Class getKeyType();
062:
063: /**
064: * The type code for elementType (0 if none).
065: *
066: * @see com.versant.core.metadata.MDStatics
067: * @see #getElementType()
068: */
069: public int getElementTypeCode();
070:
071: /**
072: * The type code for keyType (0 if none).
073: *
074: * @see com.versant.core.metadata.MDStatics
075: * @see #getKeyType()
076: */
077: public int getKeyTypeCode();
078:
079: /**
080: * Is isMaster or isManyToMany is set then this indicates if
081: * the relationship is managed by the SCOs or not.
082: */
083: public boolean isManaged();
084:
085: /**
086: * Is this field a master (one) in a master/detail (one-to-many)
087: * relationship
088: */
089: public boolean isMaster();
090:
091: /**
092: * Is this field in a many-to-many relationship?
093: */
094: public boolean isManyToMany();
095:
096: /**
097: * If isMaster, isDetail or isManyToMany is set then this is the fieldNo of
098: * the field on the other side of the relationship.
099: */
100: public int getInverseFieldNo();
101:
102: /**
103: * If isMaster, isDetail or isManyToMany is set then this is the field
104: * on the other side of the relationship.
105: */
106: public VersantFieldMetaData getInverseFieldMetaData();
107:
108: /**
109: * Get the comparator for this field if it makes sense i.e. this
110: * is a sorted Collection or Map with Comparator. This is cached.
111: */
112: public Comparator getComparator();
113:
114: /**
115: * If this is a collection, array or map and this field is true then all
116: * data must be provided in the diff instance instead of just the changes
117: * on commit or flush. This is used for datastores like VDS that always
118: * write everything.
119: */
120: boolean isIncludeAllDataInDiff();
121:
122: /**
123: * Is this an artificial field created to hold some store specific
124: * information (e.g. row version column values for a JDBC store)?
125: */
126: boolean isFake();
127: }
|