Package org.osgi.service.component.annotations

Examples of org.osgi.service.component.annotations.Property


    final Field[] fieldArray = type.getDeclaredFields();

    for (final Field field : fieldArray) {

      final Property anno = field.getAnnotation(Property.class);

      if (anno == null) {
        continue;
      }

      field.setAccessible(true);

      final String fieldName = field.getName();

      final int modifiers = field.getModifiers();

      if (!Modifier.isStatic(modifiers)) {
        throw new IllegalArgumentException(
            "property field must be static : " + fieldName);
      }

      if (!Modifier.isFinal(modifiers)) {
        throw new IllegalArgumentException(
            "property field must be final : " + fieldName);
      }

      if (!String.class.equals(field.getType())) {
        throw new IllegalArgumentException(
            "property field must be java.lang.String : "
                + fieldName + " / " + field.getType());
      }

      //

      final String name = Util.isValidText(anno.name()) ? anno.name()
          : fieldName;

      final String value;
      try {
        value = (String) field.get(null);
View Full Code Here


    final Field[] fieldArray = type.getDeclaredFields();

    for (final Field field : fieldArray) {

      final Property anno = field.getAnnotation(Property.class);

      if (anno == null) {
        continue;
      }

      field.setAccessible(true);

      final String fieldName = field.getName();

      final int modifiers = field.getModifiers();

      if (!Modifier.isStatic(modifiers)) {
        throw new IllegalArgumentException(
            "property field must be static : " + type + " / "
                + fieldName);
      }

      if (!Modifier.isFinal(modifiers)) {
        throw new IllegalArgumentException(
            "property field must be final : " + type + " / "
                + fieldName);
      }

      if (!PropertyType.isValidType(field.getType())) {
        throw new IllegalArgumentException(
            "property field type must be one of : ["
                + PropertyType.getList() + "] " + type + " / "
                + fieldName + " / " + field.getType());
      }

      //

      final String name = Util.isValidText(anno.name()) ? anno.name()
          : fieldName;

      final Object value;
      try {
        value = field.get(null);
View Full Code Here

    final Field[] fieldArray = type.getDeclaredFields();

    for (final Field field : fieldArray) {

      final Property anno = field.getAnnotation(Property.class);

      if (anno == null) {
        continue;
      }

      field.setAccessible(true);

      final String fieldName = field.getName();

      final int modifiers = field.getModifiers();

      if (!Modifier.isStatic(modifiers)) {
        throw new IllegalArgumentException(
            "property field must be static : " + type + " / "
                + fieldName);
      }

      if (!Modifier.isFinal(modifiers)) {
        throw new IllegalArgumentException(
            "property field must be final : " + type + " / "
                + fieldName);
      }

      if (!PropertyType.isValidType(field.getType())) {
        throw new IllegalArgumentException(
            "property field type must be one of : ["
                + PropertyType.getList() + "] " + type + " / "
                + fieldName + " / " + field.getType());
      }

      //

      final String name = Util.isValidText(anno.name()) ? anno.name()
          : fieldName;

      final Object value;
      try {
        value = field.get(null);
View Full Code Here

    final Field[] fieldArray = type.getDeclaredFields();

    for (final Field field : fieldArray) {

      final Property anno = field.getAnnotation(Property.class);

      if (anno == null) {
        continue;
      }

      field.setAccessible(true);

      final String fieldName = field.getName();

      final int modifiers = field.getModifiers();

      if (!Modifier.isStatic(modifiers)) {
        throw new IllegalArgumentException(
            "property field must be static : " + type + " / "
                + fieldName);
      }

      if (!Modifier.isFinal(modifiers)) {
        throw new IllegalArgumentException(
            "property field must be final : " + type + " / "
                + fieldName);
      }

      if (!PropertyType.isValidType(field.getType())) {
        throw new IllegalArgumentException(
            "property field type must be one of : ["
                + PropertyType.getList() + "] " + type + " / "
                + fieldName + " / " + field.getType());
      }

      //

      final String name = Util.isValidText(anno.name()) ? anno.name()
          : fieldName;

      final Object value;
      try {
        value = field.get(null);
View Full Code Here

TOP

Related Classes of org.osgi.service.component.annotations.Property

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.