'Language'에 해당되는 글 463건

  1. 2014.12.01 Java Reflection - Private Fields and Methods
  2. 2014.12.01 Java Reflection - Getters and Setters
  3. 2014.12.01 Java Reflection - Methods
  4. 2014.12.01 Java Reflection - Fields
  5. 2014.12.01 Java Reflection - Constructors
  6. 2014.12.01 Java Reflection - Classes
  7. 2014.12.01 Java Reflection Tutorial
  8. 2014.11.27 JAVA JSON 라이브러리 Jackson 사용법
  9. 2014.11.20 jQuery grid - jqGrid
  10. 2014.11.20 jQuery BlockUI Plugin

Java Reflection - Private Fields and Methods

Language/JAVA 2014. 12. 1. 11:41

Despite the common belief it is actually possible to access private fields and methods of other classes via Java Reflection. It is not even that difficult. This can be very handy during unit testing. This text will show you how.

Note: This only works when running the code as a standalone Java application, like you do with unit tests and regular applications. If you try to do this inside a Java Applet, you will need to fiddle around with the SecurityManager. But, since that is not something you need to do very often, it is left out of this text so far.

Accessing Private Fields

To access a private field you will need to call the Class.getDeclaredField(String name) orClass.getDeclaredFields() method. The methods Class.getField(String name) andClass.getFields() methods only return public fields, so they won't work. Here is a simple example of a class with a private field, and below that the code to access that field via Java Reflection:

public class PrivateObject {

  private String privateString = null;

  public PrivateObject(String privateString) {
    this.privateString = privateString;
  }
}
PrivateObject privateObject = new PrivateObject("The Private Value");

Field privateStringField = PrivateObject.class.
            getDeclaredField("privateString");

privateStringField.setAccessible(true);

String fieldValue = (String) privateStringField.get(privateObject);
System.out.println("fieldValue = " + fieldValue);

This code example will print out the text "fieldValue = The Private Value", which is the value of the private fieldprivateString of the PrivateObject instance created at the beginning of the code sample.

Notice the use of the method PrivateObject.class.getDeclaredField("privateString"). It is this method call that returns the private field. This method only returns fields declared in that particular class, not fields declared in any superclasses.

Notice the line in bold too. By calling Field.setAcessible(true) you turn off the access checks for this particularField instance, for reflection only. Now you can access it even if it is private, protected or package scope, even if the caller is not part of those scopes. You still can't access the field using normal code. The compiler won't allow it.

Accessing Private Methods

To access a private method you will need to call the Class.getDeclaredMethod(String name, Class[] parameterTypes) or Class.getDeclaredMethods() method. The methods Class.getMethod(String name, Class[] parameterTypes) and Class.getMethods() methods only return public methods, so they won't work. Here is a simple example of a class with a private method, and below that the code to access that method via Java Reflection:

public class PrivateObject {

  private String privateString = null;

  public PrivateObject(String privateString) {
    this.privateString = privateString;
  }

  private String getPrivateString(){
    return this.privateString;
  }
}
PrivateObject privateObject = new PrivateObject("The Private Value");

Method privateStringMethod = PrivateObject.class.
        getDeclaredMethod("getPrivateString", null);

privateStringMethod.setAccessible(true);

String returnValue = (String)
        privateStringMethod.invoke(privateObject, null);

System.out.println("returnValue = " + returnValue);

This code example will print out the text "returnValue = The Private Value", which is the value returned by the methodgetPrivateString() when invoked on the PrivateObject instance created at the beginning of the code sample.

Notice the use of the method PrivateObject.class.getDeclaredMethod("privateString"). It is this method call that returns the private method. This method only returns methods declared in that particular class, not methods declared in any superclasses.

Notice the line in bold too. By calling Method.setAcessible(true) you turn off the access checks for this particularMethod instance, for reflection only. Now you can access it even if it is private, protected or package scope, even if the caller is not part of those scopes. You still can't access the method using normal code. The compiler won't allow it.


출처 - http://tutorials.jenkov.com/java-reflection/private-fields-and-methods.html


'Language > JAVA' 카테고리의 다른 글

Java Reflection - Generics  (0) 2014.12.01
Java Reflection - Annotations  (0) 2014.12.01
Java Reflection - Getters and Setters  (0) 2014.12.01
Java Reflection - Methods  (0) 2014.12.01
Java Reflection - Fields  (0) 2014.12.01
:

Java Reflection - Getters and Setters

Language/JAVA 2014. 12. 1. 11:40

Using Java Reflection you can inspect the methods of classes and invoke them at runtime. This can be used to detect what getters and setters a given class has. You cannot ask for getters and setters explicitly, so you will have to scan through all the methods of a class and check if each method is a getter or setter.

First let's establish the rules that characterizes getters and setters:

  • Getter
    A getter method have its name start with "get", take 0 parameters, and returns a value. 

  • Setter
    A setter method have its name start with "set", and takes 1 parameter.

Setters may or may not return a value. Some setters return void, some the value set, others the object the setter were called on for use in method chaining. Therefore you should make no assumptions about the return type of a setter.

Here is a code example that finds getter and setters of a class:

public static void printGettersSetters(Class aClass){
  Method[] methods = aClass.getMethods();

  for(Method method : methods){
    if(isGetter(method)) System.out.println("getter: " + method);
    if(isSetter(method)) System.out.println("setter: " + method);
  }
}

public static boolean isGetter(Method method){
  if(!method.getName().startsWith("get"))      return false;
  if(method.getParameterTypes().length != 0)   return false;  
  if(void.class.equals(method.getReturnType()) return false;
  return true;
}

public static boolean isSetter(Method method){
  if(!method.getName().startsWith("set")) return false;
  if(method.getParameterTypes().length != 1) return false;
  return true;
}

출처 - http://tutorials.jenkov.com/java-reflection/getters-setters.html


'Language > JAVA' 카테고리의 다른 글

Java Reflection - Annotations  (0) 2014.12.01
Java Reflection - Private Fields and Methods  (0) 2014.12.01
Java Reflection - Methods  (0) 2014.12.01
Java Reflection - Fields  (0) 2014.12.01
Java Reflection - Constructors  (0) 2014.12.01
:

Java Reflection - Methods

Language/JAVA 2014. 12. 1. 11:40

Using Java Reflection you can inspect the methods of classes and invoke them at runtime. This is done via the Java class java.lang.reflect.Method. This text will get into more detail about the Java Method object.

Obtaining Method Objects

The Method class is obtained from the Class object. Here is an example:

Class aClass = ...//obtain class object
Method[] methods = aClass.getMethods();

The Method[] array will have one Method instance for each public method declared in the class.

If you know the precise parameter types of the method you want to access, you can do so rather than obtain the array all methods. This example returns the public method named "doSomething", in the given class which takes a Stringas parameter:

Class  aClass = ...//obtain class object
Method method =
    aClass.getMethod("doSomething", new Class[]{String.class});

If no method matches the given method name and arguments, in this case String.class, aNoSuchMethodException is thrown.

If the method you are trying to access takes no parameters, pass null as the parameter type array, like this:

Class  aClass = ...//obtain class object
Method method =
    aClass.getMethod("doSomething", null);

Method Parameters and Return Types

You can read what parameters a given method takes like this:

Method method = ... // obtain method - see above
Class[] parameterTypes = method.getParameterTypes();

You can access the return type of a method like this:

Method method = ... // obtain method - see above
Class returnType = method.getReturnType();

Invoking Methods using Method Object

You can invoke a method like this:

//get method that takes a String as argument
Method method = MyObject.class.getMethod("doSomething", String.class);

Object returnValue = method.invoke(null, "parameter-value1");

The null parameter is the object you want to invoke the method on. If the method is static you supply null instead of an object instance. In this example, if doSomething(String.class) is not static, you need to supply a validMyObject instance instead of null;

The Method.invoke(Object target, Object ... parameters) method takes an optional amount of parameters, but you must supply exactly one parameter per argument in the method you are invoking. In this case it was a method taking a String, so one String must be supplied.


출처 - http://tutorials.jenkov.com/java-reflection/methods.html


'Language > JAVA' 카테고리의 다른 글

Java Reflection - Private Fields and Methods  (0) 2014.12.01
Java Reflection - Getters and Setters  (0) 2014.12.01
Java Reflection - Fields  (0) 2014.12.01
Java Reflection - Constructors  (0) 2014.12.01
Java Reflection - Classes  (0) 2014.12.01
:

Java Reflection - Fields

Language/JAVA 2014. 12. 1. 11:39

Using Java Reflection you can inspect the fields (member variables) of classes and get / set them at runtime. This is done via the Java class java.lang.reflect.Field. This text will get into more detail about the Java Field object. Remember to check the JavaDoc from Sun out too.

Obtaining Field Objects

The Field class is obtained from the Class object. Here is an example:

Class aClass = ...//obtain class object
Field[] methods = aClass.getFields();

The Field[] array will have one Field instance for each public field declared in the class.

If you know the name of the field you want to access, you can access it like this:

Class  aClass = MyObject.class
Field field = aClass.getField("someField");

The example above will return the Field instance corresponding to the field someField as declared in the MyObjectbelow:

public class MyObject{
  public String someField = null;

}

If no field exists with the name given as parameter to the getField() method, a NoSuchFieldException is thrown.

Field Name

Once you have obtained a Field instance, you can get its field name using the Field.getName() method, like this:

Field field = ... //obtain field object
String fieldName = field.getName();

Field Type

You can determine the field type (String, int etc.) of a field using the Field.getType() method:

Field field = aClass.getField("someField");
Object fieldType = field.getType();

Getting and Setting Field Values

Once you have obtained a Field reference you can get and set its values using the Field.get() andField.set()methods, like this:

Class  aClass = MyObject.class
Field field = aClass.getField("someField");

MyObject objectInstance = new MyObject();

Object value = field.get(objectInstance);

field.set(objetInstance, value);

The objectInstance parameter passed to the get and set method should be an instance of the class that owns the field. In the above example an instance of MyObject is used, because the someField is an instance member of the MyObject class.

It the field is a static field (public static ...) pass null as parameter to the get and set methods, instead of theobjectInstance parameter passed above.



출처 - http://tutorials.jenkov.com/java-reflection/fields.html


'Language > JAVA' 카테고리의 다른 글

Java Reflection - Getters and Setters  (0) 2014.12.01
Java Reflection - Methods  (0) 2014.12.01
Java Reflection - Constructors  (0) 2014.12.01
Java Reflection - Classes  (0) 2014.12.01
Java Reflection Tutorial  (0) 2014.12.01
:

Java Reflection - Constructors

Language/JAVA 2014. 12. 1. 11:39

Using Java Reflection you can inspect the constructors of classes and instantiate objects at runtime. This is done via the Java class java.lang.reflect.Constructor. This text will get into more detail about the Java Constructorobject.

Obtaining Constructor Objects

The Constructor class is obtained from the Class object. Here is an example:

Class aClass = ...//obtain class object
Constructor[] constructors = aClass.getConstructors();

The Constructor[] array will have one Constructor instance for each public constructor declared in the class.

If you know the precise parameter types of the constructor you want to access, you can do so rather than obtain the array all constructors. This example returns the public constructor of the given class which takes a String as parameter:

Class aClass = ...//obtain class object
Constructor constructor =
        aClass.getConstructor(new Class[]{String.class});

If no constructor matches the given constructor arguments, in this case String.class, aNoSuchMethodException is thrown.

Constructor Parameters

You can read what parameters a given constructor takes like this:

Constructor constructor = ... // obtain constructor - see above
Class[] parameterTypes = constructor.getParameterTypes();

Instantiating Objects using Constructor Object

You can instantiate an object like this:

//get constructor that takes a String as argument
Constructor constructor = MyObject.class.getConstructor(String.class);

MyObject myObject = (MyObject)
        constructor.newInstance("constructor-arg1");

The Constructor.newInstance() method takes an optional amount of parameters, but you must supply exactly one parameter per argument in the constructor you are invoking. In this case it was a constructor taking a String, so one String must be supplied.


출처 - http://tutorials.jenkov.com/java-reflection/constructors.html


'Language > JAVA' 카테고리의 다른 글

Java Reflection - Methods  (0) 2014.12.01
Java Reflection - Fields  (0) 2014.12.01
Java Reflection - Classes  (0) 2014.12.01
Java Reflection Tutorial  (0) 2014.12.01
JAVA JSON 라이브러리 Jackson 사용법  (0) 2014.11.27
:

Java Reflection - Classes

Language/JAVA 2014. 12. 1. 11:38

Using Java Reflection you can inspect Java classes at runtime. Inspecting classes is often the first thing you do when using Reflection. From the classes you can obtain information about

plus a lot more information related to Java classes. For a full list you should consult the JavaDoc for java.lang.Class. This text will briefly touch upon all accessing of the above mentioned information. Some of the topics will also be examined in greater detail in separate texts. For instance, this text will show you how to obtain all methods or a specific method, but a separate text will show you how to invoke that method, how to find the method matching a given set of arguments if more than one method exists with the same name, what exceptions are thrown from method invocation via reflection, how to spot a getter/setter etc. The purpose of this text is primarily to introduce the Class object and the information you can obtain from it.

The Class Object

Before you can do any inspection on a class you need to obtain its java.lang.Class object. All types in Java including the primitive types (int, long, float etc.) including arrays have an associated Class object. If you know the name of the class at compile time you can obtain a Class object like this:

    Class myObjectClass = MyObject.class

If you don't know the name at compile time, but have the class name as a string at runtime, you can do like this:

String className = ... //obtain class name as string at runtime Class class = Class.forName(className);

When using the Class.forName() method you must supply the fully qualified class name. That is the class name including all package names. For instance, if MyObject is located in package com.jenkov.myapp then the fully qualified class name is com.jenkov.myapp.MyObject

The Class.forName() method may throw a ClassNotFoundException if the class cannot be found on the classpath at runtime.

Class Name

From a Class object you can obtain its name in two versions. The fully qualified class name (including package name) is obtained using the getName() method like this:

    Class aClass = ... //obtain Class object. See prev. section
    String className = aClass.getName();

If you want the class name without the pacakge name you can obtain it using the getSimpleName() method, like this:

    Class  aClass          = ... //obtain Class object. See prev. section
    String simpleClassName = aClass.getSimpleName();

Modifiers

You can access the modifiers of a class via the Class object. The class modifiers are the keywords "public", "private", "static" etc. You obtain the class modifiers like this:

  Class  aClass = ... //obtain Class object. See prev. section
  int modifiers = aClass.getModifiers();

The modifiers are packed into an int where each modifier is a flag bit that is either set or cleared. You can check the modifiers using these methods in the class java.lang.reflect.Modifier:

    Modifier.isAbstract(int modifiers)
    Modifier.isFinal(int modifiers)
    Modifier.isInterface(int modifiers)
    Modifier.isNative(int modifiers)
    Modifier.isPrivate(int modifiers)
    Modifier.isProtected(int modifiers)
    Modifier.isPublic(int modifiers)
    Modifier.isStatic(int modifiers)
    Modifier.isStrict(int modifiers)
    Modifier.isSynchronized(int modifiers)
    Modifier.isTransient(int modifiers)
    Modifier.isVolatile(int modifiers)

Package Info

You can obtain information about the package from a Class object like this:

Class  aClass = ... //obtain Class object. See prev. section
Package package = aClass.getPackage();

From the Package object you have access to information about the package like its name. You can also access information specified for this package in the Manifest file of the JAR file this package is located in on the classpath. For instance, you can specify package version numbers in the Manifest file. You can read more about the Packageclass here: java.lang.Package

Superclass

From the Class object you can access the superclass of the class. Here is how:

Class superclass = aClass.getSuperclass();

The superclass class object is a Class object like any other, so you can continue doing class reflection on that too.

Implemented Interfaces

It is possible to get a list of the interfaces implemented by a given class. Here is how:

Class  aClass = ... //obtain Class object. See prev. section
Class[] interfaces = aClass.getInterfaces();

A class can implement many interfaces. Therefore an array of Class is returned. Interfaces are also represented byClass objects in Java Reflection.

NOTE: Only the interfaces specifically declared implemented by a given class is returned. If a superclass of the class implements an interface, but the class doesn't specifically state that it also implements that interface, that interface will not be returned in the array. Even if the class in practice implements that interface, because the superclass does.

To get a complete list of the interfaces implemented by a given class you will have to consult both the class and its superclasses recursively.

Constructors

You can access the constructors of a class like this:

 Constructor[] constructors = aClass.getConstructors();

Constructors are covered in more detail in the text on Constructors.

Methods

You can access the methods of a class like this:

 Method[] method = aClass.getMethods();

Methods are covered in more detail in the text on Methods.

Fields

You can access the fields (member variables) of a class like this:

 Field[] method = aClass.getFields();

Fields are covered in more detail in the text on Fields.

Annotations

You can access the class annotations of a class like this:

 Annotation[] annotations = aClass.getAnnotations();

Annotations are covered in more detail in the text on Annotations.



출처 - http://tutorials.jenkov.com/java-reflection/classes.html#the-class-object


'Language > JAVA' 카테고리의 다른 글

Java Reflection - Fields  (0) 2014.12.01
Java Reflection - Constructors  (0) 2014.12.01
Java Reflection Tutorial  (0) 2014.12.01
JAVA JSON 라이브러리 Jackson 사용법  (0) 2014.11.27
serialVersionUID 용도  (0) 2014.11.14
:

Java Reflection Tutorial

Language/JAVA 2014. 12. 1. 11:37

Java Reflection makes it possible to inspect classes, interfaces, fields and methods at runtime, without knowing the names of the classes, methods etc. at compile time. It is also possible to instantiate new objects, invoke methods and get/set field values using reflection.

Java Reflection is quite powerful and can be very useful. For instance, when mapping objects to tables in a database at runtime, like Butterfly Persistence does. Or, when mapping the statements in a script language to method calls on real objects at runtime, like Butterfly Container does when parsing its configuration scripts.

There are already numerous Java Reflection Tutorials on the internet. However, most of them, including Sun's own Java Reflection tutorial, only scratch the surface of Java Reflection and its possibilities.

This tutorial will get into Java reflection in more depth than most of the tutorials I have seen. It will explain the basics of Java Reflection including how to work with arrays, annotations, generics and dynamic proxies, and do dynamic class loading and reloading. It will also show you how to do more specific tasks, like reading all getter methods of a class, or accessing private fields and methods of a class. This tutorial will also clear up some of the confusion out there about what Generics information is available at runtime. Some people claim that all Generics information is lost at runtime. This is not true.

This tutorial describes the version of Java Reflection found in Java 6.

Java Reflection Example

Here is a quick Java Reflection example to show you what using reflection looks like:

Method[] methods = MyObject.class.getMethods();

for(Method method : methods){
    System.out.println("method = " + method.getName());
}

This example obtains the Class object from the class called MyObject. Using the class object the example gets a list of the methods in that class, iterates the methods and print out their names.

Exactly how all this works is explained in further detail throughout the rest of this tutorial (in other texts).

Table of Contents

You can find a list of all the topics covered in this tutorial at the top left of the page. This list is repeated on all pages in this tutorial.


출처 - http://tutorials.jenkov.com/java-reflection/index.html

:

JAVA JSON 라이브러리 Jackson 사용법

Language/JAVA 2014. 11. 27. 15:19

참조 :  
1. http://jackson.codehaus.org/
2. http://wiki.fasterxml.com/JacksonInFiveMinutes

라이브러리 다운로드
http://wiki.fasterxml.com/JacksonDownload
jackson-core, jackson-databind, jackson-annotations 를 다운 받음.

Jackson 에서 JSON 처리에 제공하는 방법
1. Streaming API
     성능이 빠름.
2. Tree Model
     일반적인 XML처럼 노드형태로 Json 데이터를 다룸. 유연성이 가장 좋음. 입맛대로 구성할 수 있음.
3. Data Binding
     POJO 기반의 가자 객체들을 JSON으로 변환함.
   -Simple data Binding : 자바클래스 내의 Map, List, String, 숫자형, Boolean, null 형의 데이터들을 JSON으로 변환함.
   -Full data binding : Simple data Binding에서 제공하는것들을 포함하고 자바 빈타입에서 제공하는 데이터들도 JSON으로 변환함.


소스
* 공식사이트에 있는 import 패키지 이름이 버전업되면서 변경됐음.(2013-05-22)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
 
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
 
 
public class testJacksonJSON {
 
    /**
     * @param args
     */
    public static void main(String[] args) {
 
         
        try {
 
            ObjectMapper mapper = new ObjectMapper(); // 재사용 가능하고 전체코드에서 공유함.
 
 
            String user_json = "{\"name\" : { \"first\" : \"Joe\", \"last\" : \"Sixpack\" }, "
                    " \"gender\" : \"MALE\", "
                    " \"verified\" : false, "
                    " \"userImage\" : \"Rm9vYmFyIQ==\" " "      } ";
 
            User user = mapper.readValue(user_json, User.class);
             
            System.out.println("First name : " + user.getName().getFirst());
            System.out.println("Last name : " + user.getName().getLast());
            System.out.println("Gender : " + user.getGender());
            System.out.println("Verified : " + user.isVerified());
 
            user.getName().setFirst("ChangeJoe");
            user.getName().setLast("ChangeSixpack");
             
            String jsonStr = mapper.writeValueAsString(user);
            System.out.println("Simple Binding : "+jsonStr);
             
            //직접 raw 데이터를 입력해서 JSON형태로 출력하는 방법.
            Map<string,object> userData = new HashMap<string,object>();
            Map<string,string> nameStruct = new HashMap<string,string>();
            nameStruct.put("first""RawJoe");
            nameStruct.put("last""Sixpack");
            userData.put("name", nameStruct);
            userData.put("gender""MALE");
            userData.put("verified", Boolean.FALSE);
            userData.put("userImage""Rm9vYmFyIQ==");
             
            jsonStr = mapper.writeValueAsString(userData);
            System.out.println("Raw Data : "+jsonStr);
             
            //Tree 모델 예제
            ObjectMapper m = new ObjectMapper();
            // mapper.readTree(source), mapper.readValue(source, JsonNode.class); 둘중 하나 사용가능.
            JsonNode rootNode = m.readTree(user_json);
 
            JsonNode nameNode = rootNode.path("name");
            String lastName = nameNode.path("last").textValue();
            ((ObjectNode)nameNode).put("last""inputLast");
             
            jsonStr = m.writeValueAsString(rootNode);
            System.out.println("Tree Model : "+jsonStr);
             
             
            //Streaming API 예제
            JsonFactory f = new JsonFactory();
             
            OutputStream outStr = System.out;
 
            JsonGenerator g = f.createJsonGenerator(outStr);
 
            g.writeStartObject();
            g.writeObjectFieldStart("name");
            g.writeStringField("first""StreamAPIFirst");
            g.writeStringField("last""Sixpack");
            g.writeEndObject(); // 'name' 필드용.
            g.writeStringField("gender""MALE");
            g.writeBooleanField("verified"false);
            g.writeFieldName("userImage");
            g.writeEndObject();
            g.close(); // 사용한 다음 close해줘서 output에 있는 내용들을 flush해야함.
             
             
        catch (JsonParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        catch (JsonMappingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        catch (IOException e) {
            // TODO Auto-generated catch block
        e.printStackTrace();
        }
         
         
    }
 
}
 
class User {
    public enum Gender { MALE, FEMALE };
 
    public static class Name {
      private String _first, _last;
 
      public String getFirst() { return _first; }
      public String getLast() { return _last; }
 
      public void setFirst(String s) { _first = s; }
      public void setLast(String s) { _last = s; }
    }
 
    private Gender _gender;
    private Name _name;
    private boolean _isVerified;
    private byte[] _userImage;
 
    public Name getName() { return _name; }
    public boolean isVerified() { return _isVerified; }
    public Gender getGender() { return _gender; }
    public byte[] getUserImage() { return _userImage; }
 
    public void setName(Name n) { _name = n; }
    public void setVerified(boolean b) { _isVerified = b; }
    public void setGender(Gender g) { _gender = g; }
    public void setUserImage(byte[] b) { _userImage = b; }
}
</string,string></string,string></string,object></string,object>


출처 - http://arisu1000.tistory.com/27710

:

jQuery grid - jqGrid

Language/jQuery 2014. 11. 20. 15:28

http://www.trirand.com/blog/

'Language > jQuery' 카테고리의 다른 글

jQuery Mask Plugin  (0) 2014.12.10
jQuery checkbox 컨트롤  (0) 2014.12.08
jQuery BlockUI Plugin  (0) 2014.11.20
jquery ui plug-in  (0) 2014.11.18
jqury tools  (0) 2014.11.18
:

jQuery BlockUI Plugin

Language/jQuery 2014. 11. 20. 10:35

Overview

The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAXwithout locking the browser[1]. When activated, it will prevent user activity with the page (or part of the page) until it is deactivated. BlockUI adds elements to the DOM to give it both the appearance and behavior of blocking user interaction.

Usage is very simple; to block user activity for the page:

$.blockUI();

Blocking with a custom message:

$.blockUI({ message: '<h1><img src="busy.gif" /> Just a moment...</h1>' });

Blocking with custom style:

$.blockUI({ css: { backgroundColor: '#f00', color: '#fff'} });

To unblock the page:

$.unblockUI();

If you want to use the default settings and have the UI blocked for all ajax requests, it's as easy as this:

$(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);



출처 - http://www.malsup.com/jquery/block/

'Language > jQuery' 카테고리의 다른 글

jQuery checkbox 컨트롤  (0) 2014.12.08
jQuery grid - jqGrid  (0) 2014.11.20
jquery ui plug-in  (0) 2014.11.18
jqury tools  (0) 2014.11.18
jquery timer plug-in  (0) 2014.11.18
: