Search in sources :

Example 6 with ReferrerInfo

use of org.dbflute.dbmeta.info.ReferrerInfo in project dbflute-core by dbflute.

the class AbstractDBMeta method getReferrerInfoList.

/**
 * {@inheritDoc}
 */
public List<ReferrerInfo> getReferrerInfoList() {
    if (_referrerInfoList != null) {
        return _referrerInfoList;
    }
    synchronized (this) {
        if (_referrerInfoList != null) {
            return _referrerInfoList;
        }
        final Method[] methods = this.getClass().getMethods();
        final List<ReferrerInfo> workingList = newArrayList();
        final String prefix = "referrer";
        final Class<ReferrerInfo> returnType = ReferrerInfo.class;
        for (Method method : methods) {
            if (method.getName().startsWith(prefix) && returnType.equals(method.getReturnType())) {
                workingList.add((ReferrerInfo) DfReflectionUtil.invoke(method, this, null));
            }
        }
        _referrerInfoList = Collections.unmodifiableList(workingList);
        return _referrerInfoList;
    }
}
Also used : Method(java.lang.reflect.Method) ReferrerInfo(org.dbflute.dbmeta.info.ReferrerInfo)

Example 7 with ReferrerInfo

use of org.dbflute.dbmeta.info.ReferrerInfo in project dbflute-core by dbflute.

the class AbstractDBMeta method findReferrerInfo.

/**
 * {@inheritDoc}
 */
public ReferrerInfo findReferrerInfo(String referrerPropertyName) {
    assertStringNotNullAndNotTrimmedEmpty("referrerPropertyName", referrerPropertyName);
    final Map<String, ReferrerInfo> flexibleMap = getReferrerInfoFlexibleMap();
    final ReferrerInfo referrerInfo = flexibleMap.get(referrerPropertyName);
    if (referrerInfo == null) {
        final String notice = "The referrer info was not found.";
        final String keyName = "Referrer Property";
        throwDBMetaNotFoundException(notice, keyName, referrerPropertyName, flexibleMap.keySet());
    }
    return referrerInfo;
}
Also used : ReferrerInfo(org.dbflute.dbmeta.info.ReferrerInfo)

Example 8 with ReferrerInfo

use of org.dbflute.dbmeta.info.ReferrerInfo in project dbflute-core by dbflute.

the class AbstractDBMeta method getReferrerInfoFlexibleMap.

/**
 * Get the flexible map of referrer information.
 * @return The flexible map of referrer information. (NotNull, EmptyAllowed, ReadOnly)
 */
protected Map<String, ReferrerInfo> getReferrerInfoFlexibleMap() {
    if (_referrerInfoFlexibleMap != null) {
        return _referrerInfoFlexibleMap;
    }
    final List<ReferrerInfo> referrerInfoList = getReferrerInfoList();
    synchronized (this) {
        if (_referrerInfoFlexibleMap != null) {
            return _referrerInfoFlexibleMap;
        }
        final StringKeyMap<ReferrerInfo> map = createFlexibleConcurrentMap();
        for (ReferrerInfo referrerInfo : referrerInfoList) {
            map.put(referrerInfo.getReferrerPropertyName(), referrerInfo);
        }
        _referrerInfoFlexibleMap = Collections.unmodifiableMap(map);
        return _referrerInfoFlexibleMap;
    }
}
Also used : ReferrerInfo(org.dbflute.dbmeta.info.ReferrerInfo)

Aggregations

ReferrerInfo (org.dbflute.dbmeta.info.ReferrerInfo)8 DBMeta (org.dbflute.dbmeta.DBMeta)4 Method (java.lang.reflect.Method)1 ColumnInfo (org.dbflute.dbmeta.info.ColumnInfo)1 RelationInfo (org.dbflute.dbmeta.info.RelationInfo)1 PropertyMethodFinder (org.dbflute.dbmeta.property.PropertyMethodFinder)1