@Override public DataSource getDefaultDataSource() { if(null == defaultDataSource){ throw new ObjectNotFoundException("No default dataSource defined"); } return defaultDataSource; }
@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; }
@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; }
/** * */ public static Method getMethod(Class<?> cls,String name) throws ObjectNotFoundException, TooManyElementsException { List<Method> methods = getMethods(cls,name); if(methods.isEmpty()){ throw new ObjectNotFoundException("No such method '" + name + "' in class '" + cls.getName() + "'"); } if(methods.size() > 1){ throw new TooManyElementsException("There are " + methods.size() + " methods named '" + name + "' in class '" + cls.getName() + "'"); } return methods.get(0); }
public static ModelContext getModelContext(String className) { ModelContext mc = modelContexts.get(className); if (null == mc) { if (!Orm.hasContexts()) { throw new AppConfigException("DataSource(s) must be configured!"); } else { throw new ObjectNotFoundException("Model '" + className + "' not found in registry"); } } return mc; }
public FieldMapping getFieldMappingByMetaName(String metaFieldName) throws ObjectNotFoundException { FieldMapping fm = tryGetFieldMappingByMetaName(metaFieldName); if (null == fm) { throw new ObjectNotFoundException("No meta field '" + metaFieldName + "' in entity '" + getEntityName() + "'"); } return fm; }
public FieldMapping getFieldMapping(String fieldName) throws ObjectNotFoundException { FieldMapping fm = tryGetFieldMapping(fieldName); if (null == fm) { throw new ObjectNotFoundException("Field mapping '" + fieldName + "' not exists in entity '" + getEntityName() + "'"); } return fm; }
/** * Returns the {@link FieldMapping} object mapping to the given column (ignore case). * * @throws ObjectNotFoundException if no {@link FieldMapping} mapping to the given column. */ public FieldMapping getFieldMappingByColumn(String columnName) throws ObjectNotFoundException { FieldMapping fm = tryGetFieldMappingByColumn(columnName); if (null == fm) { throw new ObjectNotFoundException("No field mapped to the column '" + columnName + "' in entity '" + getEntityName() + "'"); } return fm; }
@Override public void fireEvent(Event event) throws ObjectNotFoundException { List<EventListener> listeners = eventListeners.get(event.getName()); if(null == listeners){ throw new ObjectNotFoundException("event name '" + event.getName() + "' not register"); } if(!fireEvent(event, listeners)){ return; } fireEvent(event, allListeners); }
public static <T> T newInstance(Class<T> type) throws ObjectNotFoundException,FactoryException { Args.notNull(type); Resource resource = getSingleClassNameResource(type); if(null == resource || !resource.exists()){ throw new ObjectNotFoundException("no instance of service class '" + type.getName() + "'"); } return newInstance(type, resource); }