Index: java/main/src/main/java/com/framsticks/params/FramsClass.java
===================================================================
--- java/main/src/main/java/com/framsticks/params/FramsClass.java	(revision 85)
+++ java/main/src/main/java/com/framsticks/params/FramsClass.java	(revision 86)
@@ -1,14 +1,11 @@
 package com.framsticks.params;
 
-import com.framsticks.params.types.StringParam;
-import com.framsticks.parsers.FileSource;
-import com.framsticks.parsers.Loaders;
-import com.framsticks.util.lang.Casting;
-
-import org.apache.log4j.Logger;
-
-import java.io.InputStream;
-import java.lang.reflect.*;
+import com.framsticks.params.annotations.FramsClassAnnotation;
+import com.framsticks.params.annotations.ParamAnnotation;
+// import com.framsticks.util.FramsticksException;
+
 import java.util.*;
+
+import javax.annotation.Nonnull;
 
 /**
@@ -24,12 +21,6 @@
  * @author Piotr Sniegowski
  */
+@FramsClassAnnotation(id = "class", name = "class")
 public final class FramsClass {
-
-	private final static Logger log = Logger.getLogger(FramsClass.class
-			.getName());
-
-	/**
-	 * The Class which represents group.
-	 */
 
 	/** The offset of the parameter (applied for newly added parameter). */
@@ -62,4 +53,5 @@
 
 	public FramsClass() {
+
 	}
 
@@ -77,4 +69,7 @@
 	 */
 	public FramsClass append(Param param) {
+		// if (param.hasFlag(Flags.USERHIDDEN)) {
+		// 	return this;
+		// }
 		paramEntryMap.put(param.getId(), param);
 		//paramEntryMap.put(param.getInternalId(), param);
@@ -104,4 +99,5 @@
 	}
 
+	@ParamAnnotation(id = "desc")
 	public String getDescription() {
 		return description;
@@ -130,9 +126,9 @@
 
 	/**
-	 * Gets the group getName.
+	 * Gets the group name.
 	 *
 	 * @param gi
 	 *            the offset of group
-	 * @return the group getName
+	 * @return the group name
 	 */
 	public String getGroupName(int gi) {
@@ -142,8 +138,10 @@
 	}
 
+	@ParamAnnotation
 	public String getId() {
 		return id;
 	}
 
+	@ParamAnnotation
 	public String getName() {
 		return name;
@@ -152,4 +150,16 @@
 	public String getNiceName() {
 		return name != null ? name : id;
+	}
+
+	public <T extends Param> T castedParam(@Nonnull final Param param, @Nonnull final Class<T> type, Object name) {
+		if (param == null) {
+			return null;
+			// throw new FramsticksException().msg("param is missing").arg("name", name).arg("in", this);
+		}
+		if (!type.isInstance(param)) {
+			return null;
+			// throw new FramsticksException().msg("wrong type of param").arg("actual", param.getClass()).arg("requested", type).arg("in", this);
+		}
+		return type.cast(param);
 	}
 
@@ -161,9 +171,6 @@
 	 * @return the param entry
 	 */
-	public <T extends Param> T getParamEntry(int i, Class<T> type) {
-		if (i < 0 || i >= paramList.size()) {
-			return null;
-		}
-		return Casting.tryCast(type, paramList.get(i));
+	public <T extends Param> T getParamEntry(final int i, @Nonnull final Class<T> type) {
+		return castedParam(getParam(i), type, i);
 	}
 
@@ -175,6 +182,20 @@
 	 * @return the param entry
 	 */
-	public <T extends Param> T getParamEntry(String id, Class<T> type) {
-		return Casting.tryCast(type, paramEntryMap.get(id));
+	public <T extends Param> T getParamEntry(@Nonnull final String id, @Nonnull final Class<T> type) {
+		return castedParam(getParam(id), type, id);
+	}
+
+	public Param getParam(int i) {
+		if (i < 0 || i >= paramList.size()) {
+			return null;
+		}
+		return paramList.get(i);
+	}
+
+	public Param getParam(String id) {
+		if (!paramEntryMap.containsKey(id)) {
+			return null;
+		}
+		return paramEntryMap.get(id);
 	}
 
@@ -188,143 +209,17 @@
 	}
 
-	public static FramsClass getFramsClass() {
-		return new FramsClass("class", "class", null)
-			.append(Param.build().id("name").name("Name").type(StringParam.class))
-			.append(Param.build().id("id").name("id").type(StringParam.class))
-			.append(Param.build().id("desc").name("Description").type(StringParam.class));
-	}
-
+	@ParamAnnotation
 	public void setId(String id) {
 		this.id = id;
 	}
 
+	@ParamAnnotation
 	public void setName(String name) {
 		this.name = name;
 	}
 
+	@ParamAnnotation(id = "desc")
 	public void setDescription(String description) {
 		this.description = description;
 	}
-
-	public static String getParamTypeForNativeType(Type type) {
-		if (type instanceof ParameterizedType) {
-			ParameterizedType p = (ParameterizedType) type;
-			Type rawType = p.getRawType();
-			if (rawType.equals(Map.class)) {
-				Type containedType = p.getActualTypeArguments()[1];
-				//TODO uid should be passed along during construction
-				if (containedType instanceof Class) {
-					return "l " + ((Class<?>) containedType).getCanonicalName()
-							+ " name";
-				}
-			}
-			if (rawType.equals(List.class)) {
-				Type containedType = p.getActualTypeArguments()[0];
-				if (containedType instanceof Class) {
-					return "l " + ((Class<?>) containedType).getCanonicalName();
-				}
-			}
-			return null;
-		}
-
-		if (type.equals(Integer.class)) {
-			return "d";
-		}
-		if (type.equals(String.class)) {
-			return "s";
-		}
-		if (type.equals(Double.class)) {
-			return "f";
-		}
-		if (type instanceof Class) {
-			return "o " + ((Class<?>) type).getCanonicalName();
-		}
-		return null;
-	}
-
-	public static final String GENERATE_HELP_PREFIX = "automatically generated from: ";
-
-	public static FramsClass readFromStream(InputStream stream) {
-		return Loaders.loadFramsClass(new FileSource(stream));
-	}
-
-	public static class Constructor {
-		protected final FramsClass result;
-		protected Class<?> currentClass;
-
-		public Constructor(Class<?> src, String name) {
-			result = new FramsClass(name, name, GENERATE_HELP_PREFIX
-					+ src.toString());
-			currentClass = src;
-			while (currentClass != null) {
-				try {
-					currentClass.getMethod("constructFramsClass", Constructor.class).invoke(null, this);
-				} catch (IllegalAccessException | IllegalArgumentException
-						| InvocationTargetException | NoSuchMethodException
-						| SecurityException e) {
-					log.debug("failed to use constructFramsClass static method (skipping): ", e);
-				}
-				currentClass = currentClass.getSuperclass();
-			}
-			currentClass = src;
-		}
-
-		public final FramsClass getResult() {
-			return result;
-		}
-
-		public Constructor allFields() {
-			for (Field f : currentClass.getFields()) {
-				field(f.getName());
-			}
-			return this;
-		}
-
-		public Constructor method(String name, Class<?> ... arguments) {
-			try {
-				Method method = currentClass.getMethod(name, arguments);
-				if (!Modifier.isPublic(method.getModifiers())) {
-					return this;
-				}
-				String returnParamClass = getParamTypeForNativeType(method.getGenericReturnType());
-				if (returnParamClass == null) {
-					return this;
-				}
-				Class<?>[] args = method.getParameterTypes();
-				if (args.length == 0) {
-					if (method.getName().startsWith("get")) {
-						String fieldName = method.getName().substring(3, 4).toLowerCase() + method.getName().substring(4);
-						Param param = Param.build().type(returnParamClass).name(fieldName).id(fieldName).help(GENERATE_HELP_PREFIX + method.toString()).finish();
-						assert param != null;
-						result.append(param);
-						return this;
-					}
-					return this;
-				}
-				return this;
-			} catch (NoSuchMethodException e) {
-				log.fatal("method " + name + " was not found in " + currentClass.toString());
-			}
-			return this;
-		}
-		public Constructor field(String name) {
-			try {
-				Field field = currentClass.getField(name);
-				if (!Modifier.isPublic(field.getModifiers())) {
-					return this;
-				}
-				String paramClass = getParamTypeForNativeType(field.getGenericType());
-				if (paramClass == null) {
-					return this;
-				}
-				Param param = Param.build().type(paramClass).name(field.getName()).id(field.getName()).help(GENERATE_HELP_PREFIX + field.toString()).finish();
-				assert param != null;
-				result.append(param);
-				return this;
-			} catch (NoSuchFieldException e) {
-				log.fatal("field " + name + " was not found in " + currentClass.toString());
-			}
-			return this;
-		}
-	}
 }
