src/org/jnetpcap/packet/structure/AnnotatedHeaderLengthMethod.java
public static AnnotatedHeaderLengthMethod[] inspectClass(
	    Class<? extends JHeader> c) {

		/*
		 * Check if we have this method cached for this class.
		 */
		if (cache.containsKey(c)) {
			return cache.get(c);
		}

		AnnotatedHeaderLengthMethod[] methods =
		    new AnnotatedHeaderLengthMethod[HeaderLength.Type.values().length];

		Header header = c.getAnnotation(Header.class);
		if (header != null && header.length() != -1) {
			methods[HeaderLength.Type.HEADER.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.length(),
			        HeaderLength.Type.HEADER);
		}

		if (header != null && header.prefix() != -1) {
			methods[HeaderLength.Type.PREFIX.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.prefix(),
			        HeaderLength.Type.PREFIX);
		}

		if (header != null && header.gap() != -1) {
			methods[HeaderLength.Type.GAP.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.gap(),
			        HeaderLength.Type.GAP);
		}

		if (header != null && header.payload() != -1) {
			methods[HeaderLength.Type.PAYLOAD.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.payload(),
			        HeaderLength.Type.PAYLOAD);
		}

		if (header != null && header.postfix() != -1) {
			methods[HeaderLength.Type.POSTFIX.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.postfix(),
			        HeaderLength.Type.POSTFIX);
		}

		for (Method method : getMethods(c, HeaderLength.class)) {

			HeaderLength hl = method.getAnnotation(HeaderLength.class);

			if (methods[hl.value().ordinal()] != null) {
				throw new AnnotatedMethodException(c, "duplicate: "
				    + methods[hl.value().ordinal()] + " property and " + method.getName()
				    + "() method");
			}

			checkSignature(method);

			methods[hl.value().ordinal()] =
			    new AnnotatedHeaderLengthMethod(method, hl.value());
		}

		if (methods[HeaderLength.Type.HEADER.ordinal()] == null) {
			throw new AnnotatedMethodException(c,
			    "@HeaderLength annotated method not found");
		}

		cache.put(c, methods);
		return methods;
	}
/**
	 * Inspect annotations within the class for length methods.
	 * 
	 * @param c
	 *          class to inspect
	 * @return array containing length methods for various header "record"
	 *         sub-structures
	 */
Inspect annotations within the class for length methods.

@param c
class to inspect
@return array containing length methods for various header "record"
sub-structures
Inspect annotations within the class for length methods . @param c class to inspect @return array containing length methods for various header " record " sub - structures
public static AnnotatedHeaderLengthMethod[] inspectClass(
	    Class<? extends JHeader> c) {
		/*
		 * Check if we have this method cached for this class.
		 */
		if (cache.containsKey(c)) {
			return cache.get(c);
		}
		AnnotatedHeaderLengthMethod[] methods =
		    new AnnotatedHeaderLengthMethod[HeaderLength.Type.values().length];
		Header header = c.getAnnotation(Header.class);
		if (header != null && header.length() != -1) {
			methods[HeaderLength.Type.HEADER.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.length(),
			        HeaderLength.Type.HEADER);
		}
		if (header != null && header.prefix() != -1) {
			methods[HeaderLength.Type.PREFIX.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.prefix(),
			        HeaderLength.Type.PREFIX);
		}
		if (header != null && header.gap() != -1) {
			methods[HeaderLength.Type.GAP.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.gap(),
			        HeaderLength.Type.GAP);
		}
		if (header != null && header.payload() != -1) {
			methods[HeaderLength.Type.PAYLOAD.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.payload(),
			        HeaderLength.Type.PAYLOAD);
		}
		if (header != null && header.postfix() != -1) {
			methods[HeaderLength.Type.POSTFIX.ordinal()] =
			    new AnnotatedHeaderLengthMethod(c, header.postfix(),
			        HeaderLength.Type.POSTFIX);
		}
		for (Method method : getMethods(c, HeaderLength.class)) {
			HeaderLength hl = method.getAnnotation(HeaderLength.class);
			if (methods[hl.value().ordinal()] != null) {
				throw new AnnotatedMethodException(c, "duplicate: "
				    + methods[hl.value().ordinal()] + " property and " + method.getName()
				    + "() method");
			}
			checkSignature(method);
			methods[hl.value().ordinal()] =
			    new AnnotatedHeaderLengthMethod(method, hl.value());
		}
		if (methods[HeaderLength.Type.HEADER.ordinal()] == null) {
			throw new AnnotatedMethodException(c,
			    "@HeaderLength annotated method not found");
		}
		cache.put(c, methods);
		return methods;
	}
public static AnnotatedHeaderLengthMethod [ ] inspectClass ( Class < ? extends JHeader > c ) { /*
		 * Check if we have this method cached for this class.
		 */ if ( cache . containsKey ( c ) ) { return cache . get ( c ) ; } AnnotatedHeaderLengthMethod [ ] methods = new AnnotatedHeaderLengthMethod [ HeaderLength . Type . values ( ) . length ] ; Header header = c . getAnnotation ( Header . class ) ; if ( header != null && header . length ( ) != - 1 ) { methods [ HeaderLength . Type . HEADER . ordinal ( ) ] = new AnnotatedHeaderLengthMethod ( c , header . length ( ) , HeaderLength . Type . HEADER ) ; } if ( header != null && header . prefix ( ) != - 1 ) { methods [ HeaderLength . Type . PREFIX . ordinal ( ) ] = new AnnotatedHeaderLengthMethod ( c , header . prefix ( ) , HeaderLength . Type . PREFIX ) ; } if ( header != null && header . gap ( ) != - 1 ) { methods [ HeaderLength . Type . GAP . ordinal ( ) ] = new AnnotatedHeaderLengthMethod ( c , header . gap ( ) , HeaderLength . Type . GAP ) ; } if ( header != null && header . payload ( ) != - 1 ) { methods [ HeaderLength . Type . PAYLOAD . ordinal ( ) ] = new AnnotatedHeaderLengthMethod ( c , header . payload ( ) , HeaderLength . Type . PAYLOAD ) ; } if ( header != null && header . postfix ( ) != - 1 ) { methods [ HeaderLength . Type . POSTFIX . ordinal ( ) ] = new AnnotatedHeaderLengthMethod ( c , header . postfix ( ) , HeaderLength . Type . POSTFIX ) ; } for ( Method method : getMethods ( c , HeaderLength . class ) ) { HeaderLength hl = method . getAnnotation ( HeaderLength . class ) ; if ( methods [ hl . value ( ) . ordinal ( ) ] != null ) { throw new AnnotatedMethodException ( c , "duplicate: " + methods [ hl . value ( ) . ordinal ( ) ] + " property and " + method . getName ( ) + "() method" ) ; } checkSignature ( method ) ; methods [ hl . value ( ) . ordinal ( ) ] = new AnnotatedHeaderLengthMethod ( method , hl . value ( ) ) ; } if ( methods [ HeaderLength . Type . HEADER . ordinal ( ) ] == null ) { throw new AnnotatedMethodException ( c , "@HeaderLength annotated method not found" ) ; } cache . put ( c , methods ) ; return methods ; }
Inspect annotations within the class for length methods.
Inspect annotations within the class for length methods .