Java 类org.gradle.api.UnknownDomainObjectException 实例源码

项目:Reer    文件:DefaultBinaryTasksCollection.java   
public <T extends Task> T findSingleTaskWithType(Class<T> type) {
    DomainObjectSet<T> tasks = withType(type);
    if (tasks.size() == 0) {
        return null;
    }
    if (tasks.size() > 1) {
        throw new UnknownDomainObjectException(String.format("Multiple tasks with type '%s' found.", type.getSimpleName()));
    }
    return tasks.iterator().next();
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
public T getByName(String name) throws UnknownDomainObjectException {
    T t = findByName(name);
    if (t == null) {
        throw createNotFoundException(name);
    }
    return t;
}
项目:Reer    文件:ExtensionsStorage.java   
public <T> T findByType(Class<T> type) {
    ExtensionHolder<T> holder;
    try {
        holder = getHolderByType(type);
    } catch (UnknownDomainObjectException e) {
        return null;
    }
    return holder.get();
}
项目:Reer    文件:ExtensionsStorage.java   
private <T> ExtensionHolder<T> getHolderByType(Class<T> type) {
    List<String> types = new LinkedList<String>();
    for (ExtensionHolder extensionHolder : extensions.values()) {
        Class<?> clazz = extensionHolder.getType();
        types.add(clazz.getSimpleName());
        if (type.isAssignableFrom(clazz)) {
            return extensionHolder;
        }
    }
    throw new UnknownDomainObjectException("Extension of type '" + type.getSimpleName() + "' does not exist. Currently registered extension types: " + types);
}
项目:Pushjet-Android    文件:DefaultBinaryTasksCollection.java   
protected <T extends Task> T findSingleTaskWithType(Class<T> type) {
    DomainObjectSet<T> tasks = withType(type);
    if (tasks.size() == 0) {
        return null;
    }
    if (tasks.size() > 1) {
        throw new UnknownDomainObjectException(String.format("Multiple tasks with type '%s' found.", type.getSimpleName()));
    }
    return tasks.iterator().next();
}
项目:Pushjet-Android    文件:ExtensionsStorage.java   
public <T> T findByType(Class<T> type) {
    ExtensionHolder<T> holder;
    try {
        holder = getHolderByType(type);
    } catch (UnknownDomainObjectException e) {
        return null;
    }
    return holder.get();
}
项目:Pushjet-Android    文件:ExtensionsStorage.java   
private <T> ExtensionHolder<T> getHolderByType(Class<T> type) {
    List<String> types = new LinkedList<String>();
    for (ExtensionHolder extensionHolder : extensions.values()) {
        Class<?> clazz = extensionHolder.getType();
        types.add(clazz.getSimpleName());
        if (type.isAssignableFrom(clazz)) {
            return extensionHolder;
        }
    }
    throw new UnknownDomainObjectException("Extension of type '" + type.getSimpleName() + "' does not exist. Currently registered extension types: " + types);
}
项目:Pushjet-Android    文件:DefaultNativeBinaryTasks.java   
private <T extends Task> T findOnlyWithType(Class<T> type) {
    DomainObjectSet<T> tasks = withType(type);
    if (tasks.size() == 0) {
        return null;
    }
    if (tasks.size() > 1) {
        throw new UnknownDomainObjectException(String.format("Multiple task with type '%s' found", type.getSimpleName()));
    }
    return tasks.iterator().next();
}
项目:Pushjet-Android    文件:ExtensionsStorage.java   
public <T> T findByType(Class<T> type) {
    ExtensionHolder<T> holder;
    try {
        holder = getHolderByType(type);
    } catch (UnknownDomainObjectException e) {
        return null;
    }
    return holder.get();
}
项目:Pushjet-Android    文件:ExtensionsStorage.java   
private <T> ExtensionHolder<T> getHolderByType(Class<T> type) {
    List<String> types = new LinkedList<String>();
    for (ExtensionHolder extensionHolder : extensions.values()) {
        Class<?> clazz = extensionHolder.getType();
        types.add(clazz.getSimpleName());
        if (type.isAssignableFrom(clazz)) {
            return extensionHolder;
        }
    }
    throw new UnknownDomainObjectException("Extension of type '" + type.getSimpleName() + "' does not exist. Currently registered extension types: " + types);
}
项目:ModsIOUpload    文件:ModsIOExtension.java   
public ModsIOExtension(Project project) {
    this.project = project;

    if (minecraft == null) {
        try {
            minecraft = (String) project.getExtensions().getByName("minecraft").getClass().getField("version").get(project.getExtensions().getByName("minecraft"));
            if (minecraft.indexOf('-') != 0) {
                minecraft = minecraft.substring(0, minecraft.indexOf('-'));
            }
        } catch (UnknownDomainObjectException ignored) {
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}
项目:ModsIOUpload    文件:ModsIOExtension.java   
public String getMinecraft() {
    if (minecraft == null) {
        try {
            minecraft = (String) project.getExtensions().getByName("minecraft").getClass().getField("version").get(project.getExtensions().getByName("minecraft"));
            if (minecraft.indexOf('-') != 0) {
                minecraft = minecraft.substring(0, minecraft.indexOf('-'));
            }
        } catch (UnknownDomainObjectException ignored) {
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }

    return minecraft;
}
项目:Reer    文件:DefaultConfigurationContainer.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownConfigurationException(String.format("Configuration with name '%s' not found.", name));
}
项目:Reer    文件:DefaultTaskCollection.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownTaskException(String.format("Task with name '%s' not found in %s.", name, project));
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
public T getByName(String name, Closure configureClosure) throws UnknownDomainObjectException {
    T t = getByName(name);
    ConfigureUtil.configure(configureClosure, t);
    return t;
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
@Override
public T getByName(String name, Action<? super T> configureAction) throws UnknownDomainObjectException {
    T t = getByName(name);
    configureAction.execute(t);
    return t;
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
public T getAt(String name) throws UnknownDomainObjectException {
    return getByName(name);
}
项目:Reer    文件:DefaultNamedDomainObjectCollection.java   
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownDomainObjectException(String.format("%s with name '%s' not found.", getTypeDisplayName(),
            name));
}
项目:Reer    文件:DefaultArtifactRepositoryContainer.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownRepositoryException(String.format("Repository with name '%s' not found.", name));
}
项目:Reer    文件:TypedDomainObjectContainerWrapper.java   
public U getAt(String name) throws UnknownDomainObjectException {
    return delegate.getAt(name);
}
项目:Reer    文件:TypedDomainObjectContainerWrapper.java   
public U getByName(String name) throws UnknownDomainObjectException {
    return delegate.getByName(name);
}
项目:Reer    文件:TypedDomainObjectContainerWrapper.java   
public U getByName(String name, Closure configureClosure) throws UnknownDomainObjectException {
    return delegate.getByName(name, configureClosure);
}
项目:Reer    文件:TypedDomainObjectContainerWrapper.java   
@Override
public U getByName(String name, Action<? super U> configureAction) throws UnknownDomainObjectException {
    return delegate.getByName(name, configureAction);
}
项目:Reer    文件:ExtensionsStorage.java   
public Object getByName(String name) {
    if (!hasExtension(name)) {
        throw new UnknownDomainObjectException("Extension with name '" + name + "' does not exist. Currently registered extension names: " + extensions.keySet());
    }
    return findByName(name);
}
项目:Pushjet-Android    文件:DefaultConfigurationContainer.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownConfigurationException(String.format("Configuration with name '%s' not found.", name));
}
项目:Pushjet-Android    文件:DefaultTaskCollection.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownTaskException(String.format("Task with name '%s' not found in %s.", name, project));
}
项目:Pushjet-Android    文件:DefaultArtifactRepositoryContainer.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownRepositoryException(String.format("Repository with name '%s' not found.", name));
}
项目:Pushjet-Android    文件:ExtensionsStorage.java   
public Object getByName(String name) {
    if (!hasExtension(name)) {
        throw new UnknownDomainObjectException("Extension with name '" + name + "' does not exist. Currently registered extension names: " + extensions.keySet());
    }
    return findByName(name);
}
项目:Pushjet-Android    文件:DefaultConfigurationContainer.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownConfigurationException(String.format("Configuration with name '%s' not found.", name));
}
项目:Pushjet-Android    文件:DefaultTaskCollection.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownTaskException(String.format("Task with name '%s' not found in %s.", name, project));
}
项目:Pushjet-Android    文件:DefaultArtifactRepositoryContainer.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownRepositoryException(String.format("Repository with name '%s' not found.", name));
}
项目:Pushjet-Android    文件:ExtensionsStorage.java   
public Object getByName(String name) {
    if (!hasExtension(name)) {
        throw new UnknownDomainObjectException("Extension with name '" + name + "' does not exist. Currently registered extension names: " + extensions.keySet());
    }
    return findByName(name);
}
项目:Reer    文件:ExtensionContainer.java   
/**
 * Looks for the extension of a given type (useful to avoid casting). If none found it will throw an exception.
 *
 * @param type extension type
 * @return extension, never null
 * @throws UnknownDomainObjectException When the given extension is not found.
 */
<T> T getByType(Class<T> type) throws UnknownDomainObjectException;
项目:Reer    文件:ExtensionContainer.java   
/**
 * Looks for the extension of a given name. If none found it will throw an exception.
 *
 * @param name extension name
 * @return extension, never null
 * @throws UnknownDomainObjectException When the given extension is not found.
 */
Object getByName(String name) throws UnknownDomainObjectException;
项目:Pushjet-Android    文件:ExtensionContainer.java   
/**
 * Looks for the extension of a given type (useful to avoid casting). If none found it will throw an exception.
 *
 * @param type extension type
 * @return extension, never null
 * @throws UnknownDomainObjectException When the given extension is not found.
 */
<T> T getByType(Class<T> type) throws UnknownDomainObjectException;
项目:Pushjet-Android    文件:ExtensionContainer.java   
/**
 * Looks for the extension of a given name. If none found it will throw an exception.
 *
 * @param name extension name
 * @return extension, never null
 * @throws UnknownDomainObjectException When the given extension is not found.
 */
Object getByName(String name) throws UnknownDomainObjectException;
项目:Pushjet-Android    文件:ExtensionContainer.java   
/**
 * Looks for the extension of a given type (useful to avoid casting). If none found it will throw an exception.
 *
 * @param type extension type
 * @return extension, never null
 * @throws UnknownDomainObjectException When the given extension is not found.
 */
<T> T getByType(Class<T> type) throws UnknownDomainObjectException;
项目:Pushjet-Android    文件:ExtensionContainer.java   
/**
 * Looks for the extension of a given name. If none found it will throw an exception.
 *
 * @param name extension name
 * @return extension, never null
 * @throws UnknownDomainObjectException When the given extension is not found.
 */
Object getByName(String name) throws UnknownDomainObjectException;