@Override public DataSource getDefaultDataSource() { if(null == defaultDataSource){ throw new ObjectNotFoundException("No default dataSource defined"); } return defaultDataSource; }
/** * Returns the matched path. */ public MApiPath getPath(String pathTemplate) { MApiPath p = paths.get(pathTemplate); if (null == p) { throw new ObjectNotFoundException("The path '" + pathTemplate + "' not exists!"); } return p; }
public MApiModel getModel(String name) { MApiModel m = models.get(name); if (null == m) { throw new ObjectNotFoundException("The model '" + name + "' not exists!"); } return m; }
/** * Returns the relation of the given name. */ public RelationMapping getRelationMapping(String name) throws ObjectNotFoundException { RelationMapping r = nameToRelations.get(name); if (null == r) { throw new ObjectNotFoundException("Relation '" + name + "' not exists in entity '" + entityName + "'"); } return r; }
@Override @SuppressWarnings("unchecked") public <K, V> Cache<K, V> getCache(String cacheName) { Cache<K,V> cache = (Cache<K,V>)caches.get(cacheName); if(null == cache){ throw new ObjectNotFoundException("Cache '" + cacheName + "' not found"); } return cache; }
@Override public MPattern getPattern(String name) throws ObjectNotFoundException { MPattern p = patterns.get(name); if(null == p){ throw new ObjectNotFoundException("MPattern '" + name + "' not found"); } return p; }
@Override public SerializeConfig getSerializeConfig(String name) throws ObjectNotFoundException { SerializeConfig sc = serializeConfigs.get(name.toLowerCase()); if(null == sc) { throw new ObjectNotFoundException("Serializer config of format'" + name + "' not found"); } return sc; }
public BeanProperty getProperty(String name,boolean ignoreCase) throws ObjectNotFoundException{ BeanProperty p = ignoreCase ? lowerCaseNamePropertyMap.get(name.toLowerCase()) : originalNamePropertyMap.get(name); if(null == p){ throw new ObjectNotFoundException("property '" + name + "' not found in class '" + beanClass.getName() + "'"); } return p; }
@Override public DataSource getDataSource(String name) throws ObjectNotFoundException { DataSource ds = tryGetDataSource(name); if(null == ds){ throw new ObjectNotFoundException("DataSource '" + name + "' not found"); } return ds; }
@Override public SequenceMapping getSequenceMapping(String sequenceName) throws ObjectNotFoundException { SequenceMapping seq = tryGetSequenceMapping(sequenceName); if(null == seq){ throw new ObjectNotFoundException("sequence '" + sequenceName + "' not found"); } return seq; }
@Override public Domain getDomain(String name) throws ObjectNotFoundException { Domain domain = tryGetDomain(name); if(null == domain){ throw new ObjectNotFoundException("The domain '" + name + "' not found"); } return domain; }
/** * Checks the name must be exists. * * @throws ObjectNotFoundException if the name not exists. */ default NamedGetter mustContains(String name) throws ObjectNotFoundException { if(!contains(name)) { throw new ObjectNotFoundException("The name '" + name + "' not exists!"); } return this; }
@Override public MSimpleParameter getUrlParameter(String name) { if(urlParameters != null){ for(int i=0;i<urlParameters.length;i++){ MSimpleParameter p = urlParameters[i]; if(p.getName().equals(name)){ return p; } } } throw new ObjectNotFoundException("Parameter '" + name + "' not found in this driver"); }
@Override public String getMessage(Locale locale, String key, Object... args) throws ObjectNotFoundException { String m = tryGetMessage(locale, key, args); if(null == m){ throw new ObjectNotFoundException("The message key '" + key + "' not found"); } return m; }
public static MethodNode getMethod(ClassNode cn,String name,String desc){ MethodNode m = tryGetMethod(cn, name, desc); if(null == m){ throw new ObjectNotFoundException("MethodNode '" + name + " " + desc + "' not found in class '" + cn.name + "'"); } return m; }
public static MSimpleType forName(String name) throws ObjectNotFoundException { MSimpleType t = tryForName(name); if(null == t){ throw new ObjectNotFoundException("Simple Type '" + name + "' not found"); } return t; }
@Override public Api get(String name) throws ObjectNotFoundException { Api api = tryGet(name); if(null == api) { throw new ObjectNotFoundException("Api '" + name + "' not exists!"); } return api; }
public static FieldNode getField(ClassNode cn,String name){ FieldNode f = tryGetField(cn, name); if(null == f){ throw new ObjectNotFoundException("FieldNode '" + name + "' not found in class '" + cn.name + "'"); } return f; }
public MPropertyBuilder getProperty(String name) throws ObjectNotFoundException { MPropertyBuilder p = findProperty(name); if(null == p){ throw new ObjectNotFoundException("Property '" + name + "' not found"); } return p; }
@Override public OrmContext getContext(String name) throws ObjectNotFoundException { OrmContext context = findContext(name); if(null == context) { throw new ObjectNotFoundException("Orm context '" + name + "' not found"); } return context; } }