Determine entity class by first using the name set on the Siren entity and then if not found using the actual class
name, though it is preferable to use the first option to not tie to a language specific class.

@param obj
@param name
@return
16622
public String[] getEntityClass(Object obj, String name, Siren4JEntity entityAnno) {
        Class<?> clazz = obj.getClass();
        String[] compClass = entityAnno == null ? null : entityAnno.entityClass();
        //If entity class specified then use it.
        if (compClass != null && !ArrayUtils.isEmpty(compClass)) {
            return compClass;
        }
        //Else use name or class.
        List<String> entityClass = new ArrayList<String>();
        entityClass.add(StringUtils.defaultString(name, clazz.getName()));
        if (obj instanceof CollectionResource) {
            String tag = getCollectionClassTag();
            if (StringUtils.isNotBlank(tag)) {
                entityClass.add(tag);
            }
        }
        return entityClass.toArray(new String[]{});
    }
869500
public Class<?> getClassByName(String name) throws ClassNotFoundException {
    return Class.forName(name, true, classLoader);
  }
485736
public static Object getField(Object obj, String name) {
    try {
      Class<? extends Object> klass = obj.getClass();
      do {
        try {
          Field field = klass.getDeclaredField(name);
          field.setAccessible(true);
          return field.get(obj);
        } catch (NoSuchFieldException e) {
          klass = klass.getSuperclass();
        }
      } while (klass != null);
      throw new RuntimeException(); // true no such field exception
    } catch (SecurityException e) {
      throw new RuntimeException(e);
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  }
1367302
public static Class getPrimitiveWrapperClassType(String name) {
        if ("string".equals(name)) {
            return String.class;
        } else if ("boolean".equals(name)) {
            return Boolean.class;
        } else if ("integer".equals(name)) {
            return Integer.class;
        } else if ("number".equals(name)) {
            return Float.class;
        }

        return null;
    }
548679
private String determineResultClassName(ClassObjectType objType) {
        String className = objType.getClassName();
        if ( List.class.getName().equals( className ) ) {
            className = ArrayList.class.getName();
        } else if ( Set.class.getName().equals( className ) ) {
            className = HashSet.class.getName();
        } else if ( Collection.class.getName().equals( className ) ) {
            className = ArrayList.class.getName();
        }
        return className;
    }
753497
@Override
  public <T> CpoClass getMetaClass(T obj) throws CpoException {
    CpoClass cpoClass = null;
    String className;
    String requestedName;
    List<Class<?>> classList = new ArrayList<>();
    Class<?> requestedClass;

    if (obj != null) {
      requestedClass = obj.getClass();
      classList.add(requestedClass);
      requestedName = requestedClass.getName();
      className = requestedName;
      cpoClass = classMap.get(className);

      while (cpoClass == null && !classList.isEmpty()) {
        classList = getSuperClasses(classList);
        for (Class<?> clazz : classList) {
          className = clazz.getName();
          cpoClass = classMap.get(className);
          if (cpoClass != null)
            break;
        }
      }
      if (cpoClass == null) {
        throw new CpoException("No Metadata found for class:" + requestedName);
      }
    }

    return cpoClass;
  }
1332552
@Override
	protected Class<?> findClass(final String name) throws ClassNotFoundException {
		log.trace("findClass:" + name);
		Class<?> clazz = findLoadedClass(name);
		if (clazz != null) {
			return clazz;
		}
		return super.findClass(name);
	}
987215
public static @Nonnull Class<?> _findClass(ClassLoader cl, String name) throws ClassNotFoundException {
        synchronized (getClassLoadingLock(cl, name)) {
            return (Class) invoke(FIND_CLASS, ClassNotFoundException.class, cl, name);
        }
    }
828323
public Object toObject(Entity entity, Class targetClass) {
        if (registry == null) {
            LOG.warn("No ResourceRegistry set, using default which "
                    + "will scan the entire classpath. It would be better to set your own registry that filters by packages.");
            try {
                registry = ResourceRegistryImpl.newInstance((String[]) null);
            } catch (Siren4JException e) {
                throw new Siren4JRuntimeException(e);
            }
        }
        Resource resource = null;
        if (entity != null) {
            String sirenClass = targetClass != null
                    ? targetClass.getName()
                    : (String) entity.getProperties().get(Siren4J.CLASS_RESERVED_PROPERTY);
            String[] eClass = entity.getComponentClass();
            if (StringUtils.isBlank(sirenClass) && (eClass == null || eClass.length == 0)) {
                throw new Siren4JConversionException(
                        "No entity class defined, won't be able to match to Java class. Can't go on.");
            }

            if (StringUtils.isBlank(sirenClass)) {
                sirenClass = eClass[0];
            }
            if (!registry.containsEntityEntry(sirenClass)) {
                throw new Siren4JConversionException("No matching resource found in the registry. Can't go on.");
            }
            Class<?> clazz = registry.getClassByEntityName(sirenClass);
            List<ReflectedInfo> fieldInfo = ReflectionUtils.getExposedFieldInfo(clazz);
            Object obj = null;
            try {
                obj = clazz.newInstance();
            } catch (Exception e) {
                throw new Siren4JConversionException(e);
            }

            // Set properties
            handleSetProperties(obj, clazz, entity, fieldInfo);
            // Set sub entities
            handleSetSubEntities(obj, clazz, entity, fieldInfo);

            resource = (Resource) obj;
        }
        return resource;
    }
1185664
public static String getClassName(Object obj) {
        String className = obj.getClass().getName();
        className = className.substring(className.lastIndexOf('.') + 1);
        return className;
    }
983800
@Override
    public EntityDecl findEntity(String entName)
    {
        if (mPredefdGEs != null) {
            EntityDecl decl = mPredefdGEs.get(entName);
            if (decl != null) {
                return decl;
            }
        }
        return mGeneralEntities.get(entName);
    }
728510
private Class getClassForElementName(String name) {
		Class clazz = (Class) nameToClass.get(name);
		if (clazz != null) {
			return clazz;
		}
		
		if (defaultPackage != null) {
			try {
				return Class.forName(defaultPackage+"."+name);
			} catch (ClassNotFoundException e) {
				// ignore, it's just not there
			}
		}
		
		return null;
	}
959599
public Class<?> getClass(final String name) throws UtilEvalError {
        final Class<?> c = this.getClassImpl(name);
        if (c != null)
            return c;
        if (this.parent != null)
            return this.parent.getClass(name);
        return null;
    }
737748
@CheckForNull
    public static JavaClass getOuterClass(JavaClass obj) throws ClassNotFoundException {
        for (Attribute a : obj.getAttributes()) {
            if (a instanceof InnerClasses) {
                for (InnerClass ic : ((InnerClasses) a).getInnerClasses()) {
                    if (obj.getClassNameIndex() == ic.getInnerClassIndex()) {
                        // System.out.println("Outer class is " +
                        // ic.getOuterClassIndex());
                        ConstantClass oc = (ConstantClass) obj.getConstantPool().getConstant(ic.getOuterClassIndex());
                        String ocName = oc.getBytes(obj.getConstantPool());
                        return Repository.lookupClass(ocName);
                    }
                }
            }
        }
        return null;
    }
653997
public EntityType getEntityType(Class<?> entityClass) {
    String className = entityClass.getName();
    EntityType type = entityTypes.get(className);
    if (null != type) { return type; }

    type = classEntityTypes.get(className);
    if (null == type) {
      List<EntityType> matched = CollectUtils.newArrayList();
      for (EntityType entityType : entityTypes.values()) {
        if (className.equals(entityType.getEntityName())
            || className.equals(entityType.getEntityClass().getName())) {
          matched.add(entityType);
        }
      }
      if (matched.size() > 1) { throw new RuntimeException("multi-entityName for class:" + className); }
      if (matched.isEmpty()) {
        EntityType tmp = new EntityType(entityClass);
        classEntityTypes.put(className, tmp);
        return tmp;
      } else {
        classEntityTypes.put(className, matched.get(0));
        type = (EntityType) matched.get(0);
      }
    }
    return type;
  }
813703
@SuppressWarnings("unchecked")
	public <T> T findById(String id, Class<T> entity) {
		if (entity == null) {
			throw new ApitraryOrmException("Cannot access null entity");
		}
		if (id == null || id.isEmpty()) {
			return null;
		}

		log.debug("Searching " + entity.getName() + " " + id);

		GetRequest request = new GetRequest();
		request.setEntity(resolveApitraryEntity(entity));
		request.setId(id);
		GetResponse response = resolveApitraryClient().send(request);

		T result = (T) new GetResponseUnmarshaller(this).unMarshall(response, entity);

		if (result != null) {
			List<Field> fields = ClassUtil.getAnnotatedFields(entity, Id.class);
			if (fields.isEmpty() || fields.size() > 1) {
				throw new ApitraryOrmIdException("Illegal amount of annotated id properties of class " + entity.getClass().getName());
			} else {
				ClassUtil.setSilent(result, fields.get(0).getName(), id);
			}
		}
		return result;
	}
61661
protected byte[] getClassDefinition(final String name0) {
        if (typeNotFound(name0)) return null;
        byte[] ba = null;
        String name = name0.replace(".", "/") + ".class";
        InputStream is = getResourceAsStream(name);
        if (null != is) {
            try {
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                byte[] buffer = new byte[8192];
                int count;
                while ((count = is.read(buffer, 0, buffer.length)) > 0) {
                    os.write(buffer, 0, count);
                }
                ba = os.toByteArray();
            } catch (Exception e) {
                throw new RuntimeException(e);
            } finally {
                try {
                    is.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
        if (null == ba) {
            IByteCodeHelper helper = engine.conf().byteCodeHelper();
            if (null != helper) {
                ba = helper.findByteCode(name0);
            }
        }
        if (null == ba) {
            setTypeNotFound(name0);
        }
        return ba;
    }