Search in sources :

Example 1 with UDFCustomType

use of lucee.runtime.type.UDFCustomType in project Lucee by lucee.

the class ModernApplicationContext method getCustomType.

@Override
public CustomType getCustomType(String strType) {
    if (!initCustomTypes) {
        if (customTypes == null)
            customTypes = new HashMap<String, CustomType>();
        // this.type.susi=function(any value){};
        Struct sct = Caster.toStruct(get(component, KeyConstants._type, null), null);
        if (sct != null) {
            Iterator<Entry<Key, Object>> it = sct.entryIterator();
            Entry<Key, Object> e;
            UDF udf;
            while (it.hasNext()) {
                e = it.next();
                udf = Caster.toFunction(e.getValue(), null);
                if (udf != null)
                    customTypes.put(e.getKey().getLowerString(), new UDFCustomType(udf));
            }
        }
        initCustomTypes = true;
    }
    return customTypes.get(strType.trim().toLowerCase());
}
Also used : Entry(java.util.Map.Entry) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) UDF(lucee.runtime.type.UDF) UDFCustomType(lucee.runtime.type.UDFCustomType) Key(lucee.runtime.type.Collection.Key) Struct(lucee.runtime.type.Struct)

Aggregations

HashMap (java.util.HashMap)1 Entry (java.util.Map.Entry)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Key (lucee.runtime.type.Collection.Key)1 Struct (lucee.runtime.type.Struct)1 UDF (lucee.runtime.type.UDF)1 UDFCustomType (lucee.runtime.type.UDFCustomType)1