Get record and cast it with {@link org.s1.objects.Objects#cast(Object, Class)}

@param cls
@param name
@param closure
@param <T>
@return
171478
public <T> T get(Class<T> cls, String name, Closure<String,T> closure){
        return Objects.cast(get(name,closure),cls);
    }
583932
public <X> X cast(final Class<X> cls) {
        if (cls == null) {
            throw new IllegalArgumentException("Parameter 'cls' muss angegeben werden");
        }

        final Class<?> beanClass = bean.getClass();
        if (cls.isAssignableFrom(beanClass)) {
            return cls.cast(bean);
        }
        throw new ClassCastException("Klasse " + beanClass + " kann nicht nach " + cls + " gewandelt werden");
    }
764356
function(name) {
    var cls = new Class(name,{
      inherits: Error,
      constructor: function(message) {
        this.name = name;
        this.message = message;
      },
    });
    return cls.toFunction();
  }
1066436
Object getObjectFromConstantFields(Class cls) {
		Field[] fields = cls.getFields();
		Object instance = null;
		for (Field field : fields) {
			instance = getObjectFromConstantField(cls, field);
			if(instance!=null) {
				break;
			}
		}
		return instance;
	}
710048
public static final <T extends Recyclable> T get(Class<T> cls)
    {
        return get(cls, null);
    }
1196908
public ClassRecord getClassRecord (String className)
    {
        Iterator<ClassRecord> iter = _classes.values().iterator();
        while (iter.hasNext()) {
            ClassRecord crec = iter.next();
            if (crec.name.equals(className)) {
                return crec;
            }
        }
        log.warning("No such color class", "class", className, new Exception());
        return null;
    }
829311
@VisibleForTesting
    static Method getMethod(Class<?> cls, String name, Class<?>... params) {
        Method m;
        try {
            m = cls.getDeclaredMethod(name, params);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        m.setAccessible(true);
        return m;
    }
464181
public static <T> Iterable<T> each(Iterable<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) {
        each(self.iterator(), closure);
        return self;
    }
304110
public static <T> Iterator<T> each(Iterator<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) {
        while (self.hasNext()) {
            Object arg = self.next();
            closure.call(arg);
        }
        return self;
    }
914934
public void call(String name, Collection coll, @DelegatesTo(StreamingJsonDelegate.class) Closure c) throws IOException {
        call(name, (Iterable)coll, c);
    }
796568
@SuppressWarnings("unchecked")
    private <T> Optional<T> getValue(Object object, Supplier<Object> method, Class<T> cls) {

        T source = null;
        if (cls.isInstance(method.get())) {
            source = (T) method.get();
        } else {
            if (CoreParameters.DEVELOPER_MODE.get()) {
                throw new CoreRuntimeException("Cannot cast object " + method.get() + " to " + cls.toGenericString());
            }
        }
        return Optional.ofNullable(source);
    }
1000570
public Object use(Closure closure) {
        // grab existing meta (usually adaptee but we may have nested use calls)
        MetaClass origMetaClass = registry.getMetaClass(theClass);
        registry.setMetaClass(theClass, this);
        try {
            return closure.call();
        } finally {
            registry.setMetaClass(theClass, origMetaClass);
        }
    }
1339893
public static Object loadGenInstance(Class<?> cls) throws ParserException
    {
        try
        {
            Class<?> parserClass;
            try
            {
                parserClass = loadGenClass(cls);
            }
            catch (ClassNotFoundException ex)
            {
                return null;
            }
            return parserClass.newInstance();
        }
        catch (InstantiationException | IllegalAccessException ex)
        {
            throw new ParserException(ex);
        }
    }
499615
public static @CheckForNull Class<?> _findLoadedClass(ClassLoader cl, String name) {
        synchronized (getClassLoadingLock(cl, name)) {
            return (Class) invoke(FIND_LOADED_CLASS, RuntimeException.class, cl, name);
        }
    }
550442
def get_record(self, name):
        

        return set().union(self.records.get(name, set()))
482684
private static <T> T cast(Class<T> clazz, Object o) {
        if (! clazz.isInstance(o))
            throw new IllegalArgumentException(o.toString());
        return clazz.cast(o);
    }
72576
<V> V execute(final TransactionalClosureWithReturn<V> closure) {
        return getSessionFactory().doInSession(
                new Callable<V>() {
                    @Override
                    public V call() {
                        PersistenceSession persistenceSession = getPersistenceSession();
                        persistenceSession.getServicesInjector().injectServicesInto(closure);
                        return doExecute(closure);
                    }
                }
        );
    }